By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,370 Members | 1,574 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,370 IT Pros & Developers. It's quick & easy.

smtp.Send fail

P: n/a


I have a form with the following fields:

UserEmail
Subject
Body

When the form is submitted, the email is processed fine. When I try
to add another field to the mm.body (mm.Body = Body.Text &
Listbox1.SelectedItem.Text) the smtp.Send fails. Any ideas ?
Code:

<script runat="server">
Protected Sub SendEmail_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles SendEmail.Click
'!!! UPDATE THIS VALUE TO YOUR EMAIL ADDRESS
Const ToAddress As String = "ab*@abc.com"

'(1) Create the MailMessage instance
Dim mm As New Net.Mail.MailMessage(UsersEmail.Text, ToAddress)

'(2) Assign the MailMessage's properties
mm.Subject = Subject.Text
mm.Body = Body.Text & TextBox1.Text
mm.IsBodyHtml = False

'(3) Create the SmtpClient object
Dim smtp As New Net.Mail.SmtpClient

'(4) Send the MailMessage (will use the Web.config settings)
smtp.Send(mm)
End Sub
</script>

Sep 22 '07 #1
Share this Question
Share on Google+
16 Replies


P: n/a
Does the server have smtp

if not you need to tell smtpclient where to find one

Dim message As New MailMessage("sender@address", "from@address", "Subject",
"Message Text")

Dim emailClient As New SmtpClient("Email Server Name")

emailClient.Send(message)

<bg********@yahoo.comwrote in message
news:11**********************@w3g2000hsg.googlegro ups.com...
>

I have a form with the following fields:

UserEmail
Subject
Body

When the form is submitted, the email is processed fine. When I try
to add another field to the mm.body (mm.Body = Body.Text &
Listbox1.SelectedItem.Text) the smtp.Send fails. Any ideas ?
Code:

<script runat="server">
Protected Sub SendEmail_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles SendEmail.Click
'!!! UPDATE THIS VALUE TO YOUR EMAIL ADDRESS
Const ToAddress As String = "ab*@abc.com"

'(1) Create the MailMessage instance
Dim mm As New Net.Mail.MailMessage(UsersEmail.Text, ToAddress)

'(2) Assign the MailMessage's properties
mm.Subject = Subject.Text
mm.Body = Body.Text & TextBox1.Text
mm.IsBodyHtml = False

'(3) Create the SmtpClient object
Dim smtp As New Net.Mail.SmtpClient

'(4) Send the MailMessage (will use the Web.config settings)
smtp.Send(mm)
End Sub
</script>
Sep 22 '07 #2

P: n/a
sorry did not read your post correctly

try writing

response.write(Body.Text & Listbox1.SelectedItem.Text)

see what you get
<bg********@yahoo.comwrote in message
news:11**********************@w3g2000hsg.googlegro ups.com...
>

I have a form with the following fields:

UserEmail
Subject
Body

When the form is submitted, the email is processed fine. When I try
to add another field to the mm.body (mm.Body = Body.Text &
Listbox1.SelectedItem.Text) the smtp.Send fails. Any ideas ?
Code:

<script runat="server">
Protected Sub SendEmail_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles SendEmail.Click
'!!! UPDATE THIS VALUE TO YOUR EMAIL ADDRESS
Const ToAddress As String = "ab*@abc.com"

'(1) Create the MailMessage instance
Dim mm As New Net.Mail.MailMessage(UsersEmail.Text, ToAddress)

'(2) Assign the MailMessage's properties
mm.Subject = Subject.Text
mm.Body = Body.Text & TextBox1.Text
mm.IsBodyHtml = False

'(3) Create the SmtpClient object
Dim smtp As New Net.Mail.SmtpClient

'(4) Send the MailMessage (will use the Web.config settings)
smtp.Send(mm)
End Sub
</script>
Sep 22 '07 #3

P: n/a

Also.....

Put a try/catch block around the code and see what that kicks up if anything
"ThatsIT.net.au" <me@thatsitwrote in message
news:14**********************************@microsof t.com...
Does the server have smtp

if not you need to tell smtpclient where to find one

Dim message As New MailMessage("sender@address", "from@address",
"Subject", "Message Text")

Dim emailClient As New SmtpClient("Email Server Name")

emailClient.Send(message)

<bg********@yahoo.comwrote in message
news:11**********************@w3g2000hsg.googlegro ups.com...
>>

I have a form with the following fields:

UserEmail
Subject
Body

When the form is submitted, the email is processed fine. When I try
to add another field to the mm.body (mm.Body = Body.Text &
Listbox1.SelectedItem.Text) the smtp.Send fails. Any ideas ?
Code:

<script runat="server">
Protected Sub SendEmail_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles SendEmail.Click
'!!! UPDATE THIS VALUE TO YOUR EMAIL ADDRESS
Const ToAddress As String = "ab*@abc.com"

'(1) Create the MailMessage instance
Dim mm As New Net.Mail.MailMessage(UsersEmail.Text, ToAddress)

'(2) Assign the MailMessage's properties
mm.Subject = Subject.Text
mm.Body = Body.Text & TextBox1.Text
mm.IsBodyHtml = False

'(3) Create the SmtpClient object
Dim smtp As New Net.Mail.SmtpClient

'(4) Send the MailMessage (will use the Web.config settings)
smtp.Send(mm)
End Sub
</script>

Sep 22 '07 #4

P: n/a
On Sep 22, 2:48 am, "ThatsIT.net.au" <me@thatsitwrote:
sorry did not read your post correctly

try writing

response.write(Body.Text & Listbox1.SelectedItem.Text)

see what you get

<bgreer5...@yahoo.comwrote in message

news:11**********************@w3g2000hsg.googlegro ups.com...


I have a form with the following fields:
UserEmail
Subject
Body
When the form is submitted, the email is processed fine. When I try
to add another field to the mm.body (mm.Body = Body.Text &
Listbox1.SelectedItem.Text) the smtp.Send fails. Any ideas ?
Code:
<script runat="server">
Protected Sub SendEmail_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles SendEmail.Click
'!!! UPDATE THIS VALUE TO YOUR EMAIL ADDRESS
Const ToAddress As String = "a...@abc.com"
'(1) Create the MailMessage instance
Dim mm As New Net.Mail.MailMessage(UsersEmail.Text, ToAddress)
'(2) Assign the MailMessage's properties
mm.Subject = Subject.Text
mm.Body = Body.Text & TextBox1.Text
mm.IsBodyHtml = False
'(3) Create the SmtpClient object
Dim smtp As New Net.Mail.SmtpClient
'(4) Send the MailMessage (will use the Web.config settings)
smtp.Send(mm)
End Sub
</script>- Hide quoted text -

- Show quoted text -
I tried the response.write and I get a valid text string. When I try
to use Body.Text & Listbox1.SelectedItem.text togethor I get the
following failure:

Exception Details: System.Net.Mail.SmtpException: Service not
available, closing transmission channel. The server response was:
Command timeout, closing transmission channel

It's almost as if the server is timing out.

Sep 22 '07 #5

P: n/a
On Sep 22, 2:50 am, "Just Me" <news.microsoft.comwrote:
Also.....

Put a try/catch block around the code and see what that kicks up if anything

"ThatsIT.net.au" <me@thatsitwrote in message

news:14**********************************@microsof t.com...
Does the server have smtp
if not you need to tell smtpclient where to find one
Dim message As New MailMessage("sender@address", "from@address",
"Subject", "Message Text")
Dim emailClient As New SmtpClient("Email Server Name")
emailClient.Send(message)
<bgreer5...@yahoo.comwrote in message
news:11**********************@w3g2000hsg.googlegro ups.com...
I have a form with the following fields:
UserEmail
Subject
Body
When the form is submitted, the email is processed fine. When I try
to add another field to the mm.body (mm.Body = Body.Text &
Listbox1.SelectedItem.Text) the smtp.Send fails. Any ideas ?
Code:
<script runat="server">
Protected Sub SendEmail_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles SendEmail.Click
'!!! UPDATE THIS VALUE TO YOUR EMAIL ADDRESS
Const ToAddress As String = "a...@abc.com"
'(1) Create the MailMessage instance
Dim mm As New Net.Mail.MailMessage(UsersEmail.Text, ToAddress)
'(2) Assign the MailMessage's properties
mm.Subject = Subject.Text
mm.Body = Body.Text & TextBox1.Text
mm.IsBodyHtml = False
'(3) Create the SmtpClient object
Dim smtp As New Net.Mail.SmtpClient
'(4) Send the MailMessage (will use the Web.config settings)
smtp.Send(mm)
End Sub
</script>- Hide quoted text -

- Show quoted text -
I put the Try Catch block around the script and it worked. Why would
adding a try catch eliminate the problem?

Sep 22 '07 #6

P: n/a
On Sep 22, 3:15 am, "bgreer5...@yahoo.com" <bgreer5...@yahoo.com>
wrote:
On Sep 22, 2:48 am, "ThatsIT.net.au" <me@thatsitwrote:


sorry did not read your post correctly
try writing
response.write(Body.Text & Listbox1.SelectedItem.Text)
see what you get
<bgreer5...@yahoo.comwrote in message
news:11**********************@w3g2000hsg.googlegro ups.com...
I have a form with the following fields:
UserEmail
Subject
Body
When the form is submitted, the email is processed fine. When I try
to add another field to the mm.body (mm.Body = Body.Text &
Listbox1.SelectedItem.Text) the smtp.Send fails. Any ideas ?
Code:
<script runat="server">
Protected Sub SendEmail_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles SendEmail.Click
'!!! UPDATE THIS VALUE TO YOUR EMAIL ADDRESS
Const ToAddress As String = "a...@abc.com"
'(1) Create the MailMessage instance
Dim mm As New Net.Mail.MailMessage(UsersEmail.Text, ToAddress)
'(2) Assign the MailMessage's properties
mm.Subject = Subject.Text
mm.Body = Body.Text & TextBox1.Text
mm.IsBodyHtml = False
'(3) Create the SmtpClient object
Dim smtp As New Net.Mail.SmtpClient
'(4) Send the MailMessage (will use the Web.config settings)
smtp.Send(mm)
End Sub
</script>- Hide quoted text -
- Show quoted text -

I tried the response.write and I get a valid text string. When I try
to use Body.Text & Listbox1.SelectedItem.text togethor I get the
following failure:

Exception Details: System.Net.Mail.SmtpException: Service not
available, closing transmission channel. The server response was:
Command timeout, closing transmission channel

It's almost as if the server is timing out.- Hide quoted text -

- Show quoted text -
Well....I guess I do not understand the Try/Catch. The page did not
error out, but the email was never sent as well.

Sep 22 '07 #7

P: n/a
The point of the try catch is this

Try

Your Stuff

Catch ex as exception

'// Look at your exception message here, it will give you more
information

End Try
<bg********@yahoo.comwrote in message
news:11*********************@g4g2000hsf.googlegrou ps.com...
On Sep 22, 3:15 am, "bgreer5...@yahoo.com" <bgreer5...@yahoo.com>
wrote:
>On Sep 22, 2:48 am, "ThatsIT.net.au" <me@thatsitwrote:


sorry did not read your post correctly
try writing
response.write(Body.Text & Listbox1.SelectedItem.Text)
see what you get
<bgreer5...@yahoo.comwrote in message
>news:11**********************@w3g2000hsg.googlegr oups.com...
I have a form with the following fields:
UserEmail
Subject
Body
When the form is submitted, the email is processed fine. When I try
to add another field to the mm.body (mm.Body = Body.Text &
Listbox1.SelectedItem.Text) the smtp.Send fails. Any ideas ?
Code:
<script runat="server">
Protected Sub SendEmail_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles SendEmail.Click
'!!! UPDATE THIS VALUE TO YOUR EMAIL ADDRESS
Const ToAddress As String = "a...@abc.com"
'(1) Create the MailMessage instance
Dim mm As New Net.Mail.MailMessage(UsersEmail.Text, ToAddress)
'(2) Assign the MailMessage's properties
mm.Subject = Subject.Text
mm.Body = Body.Text & TextBox1.Text
mm.IsBodyHtml = False
'(3) Create the SmtpClient object
Dim smtp As New Net.Mail.SmtpClient
'(4) Send the MailMessage (will use the Web.config settings)
smtp.Send(mm)
End Sub
</script>- Hide quoted text -
- Show quoted text -

I tried the response.write and I get a valid text string. When I try
to use Body.Text & Listbox1.SelectedItem.text togethor I get the
following failure:

Exception Details: System.Net.Mail.SmtpException: Service not
available, closing transmission channel. The server response was:
Command timeout, closing transmission channel

It's almost as if the server is timing out.- Hide quoted text -

- Show quoted text -

Well....I guess I do not understand the Try/Catch. The page did not
error out, but the email was never sent as well.

Sep 22 '07 #8

P: n/a
Hi,

First of all, check if it's a code problem, or if it is a network /
permissions issue, try to send and e-mail using telnet:

http://msexchangeteam.com/archive/20...14/428324.aspx

If you cannot send an e-mail using this, just grab the network admin and
have a chat with him.

I have compiled good info about SMTP and .net (FAQS and Articles):

http://www.tipsdotnet.com/ArticleBlo...TP&PageIndex=0

Good luck
Braulio

/// ------------------------------
/// Braulio Diez
///
/// http://www.tipsdotnet.com
/// ------------------------------


"bg********@yahoo.com" wrote:
On Sep 22, 3:15 am, "bgreer5...@yahoo.com" <bgreer5...@yahoo.com>
wrote:
On Sep 22, 2:48 am, "ThatsIT.net.au" <me@thatsitwrote:


sorry did not read your post correctly
try writing
response.write(Body.Text & Listbox1.SelectedItem.Text)
see what you get
<bgreer5...@yahoo.comwrote in message
>news:11**********************@w3g2000hsg.googlegr oups.com...
I have a form with the following fields:
UserEmail
Subject
Body
When the form is submitted, the email is processed fine. When I try
to add another field to the mm.body (mm.Body = Body.Text &
Listbox1.SelectedItem.Text) the smtp.Send fails. Any ideas ?
Code:
<script runat="server">
Protected Sub SendEmail_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles SendEmail.Click
'!!! UPDATE THIS VALUE TO YOUR EMAIL ADDRESS
Const ToAddress As String = "a...@abc.com"
'(1) Create the MailMessage instance
Dim mm As New Net.Mail.MailMessage(UsersEmail.Text, ToAddress)
'(2) Assign the MailMessage's properties
mm.Subject = Subject.Text
mm.Body = Body.Text & TextBox1.Text
mm.IsBodyHtml = False
'(3) Create the SmtpClient object
Dim smtp As New Net.Mail.SmtpClient
'(4) Send the MailMessage (will use the Web.config settings)
smtp.Send(mm)
End Sub
</script>- Hide quoted text -
- Show quoted text -
I tried the response.write and I get a valid text string. When I try
to use Body.Text & Listbox1.SelectedItem.text togethor I get the
following failure:

Exception Details: System.Net.Mail.SmtpException: Service not
available, closing transmission channel. The server response was:
Command timeout, closing transmission channel

It's almost as if the server is timing out.- Hide quoted text -

- Show quoted text -

Well....I guess I do not understand the Try/Catch. The page did not
error out, but the email was never sent as well.

Sep 22 '07 #9

P: n/a

<bg********@yahoo.comwrote in message
news:11*********************@k79g2000hse.googlegro ups.com...
On Sep 22, 2:48 am, "ThatsIT.net.au" <me@thatsitwrote:
>sorry did not read your post correctly

try writing

response.write(Body.Text & Listbox1.SelectedItem.Text)

see what you get

<bgreer5...@yahoo.comwrote in message

news:11**********************@w3g2000hsg.googlegr oups.com...


I have a form with the following fields:
UserEmail
Subject
Body
When the form is submitted, the email is processed fine. When I try
to add another field to the mm.body (mm.Body = Body.Text &
Listbox1.SelectedItem.Text) the smtp.Send fails. Any ideas ?
Code:
<script runat="server">
Protected Sub SendEmail_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles SendEmail.Click
'!!! UPDATE THIS VALUE TO YOUR EMAIL ADDRESS
Const ToAddress As String = "a...@abc.com"
'(1) Create the MailMessage instance
Dim mm As New Net.Mail.MailMessage(UsersEmail.Text, ToAddress)
'(2) Assign the MailMessage's properties
mm.Subject = Subject.Text
mm.Body = Body.Text & TextBox1.Text
mm.IsBodyHtml = False
'(3) Create the SmtpClient object
Dim smtp As New Net.Mail.SmtpClient
'(4) Send the MailMessage (will use the Web.config settings)
smtp.Send(mm)
End Sub
</script>- Hide quoted text -

- Show quoted text -

I tried the response.write and I get a valid text string. When I try
to use Body.Text & Listbox1.SelectedItem.text togethor I get the
following failure:

Exception Details: System.Net.Mail.SmtpException: Service not
available, closing transmission channel. The server response was:
Command timeout, closing transmission channel

It's almost as if the server is timing out.

This error seems not to be related to your text string, but to do with smtp
not being available.
make sure you have smtp working and tell smtp client what computer it is on

Dim emailClient As New SmtpClient("Email Server Name")

Sep 23 '07 #10

P: n/a


Thank you very much. The SMTP server I use is on a remote system. Is
there a way to use the "telnet localhost smtp" command with my remote
smtp proivider?

The smtp server is smtp.infosaic.com.

Thanks

P.S. Nice Blog

Sep 24 '07 #11

P: n/a
it would be

telnet hostname or ip 25
then begin the smtp protocol

<bg********@yahoo.comwrote in message
news:11*********************@o80g2000hse.googlegro ups.com...
>

Thank you very much. The SMTP server I use is on a remote system. Is
there a way to use the "telnet localhost smtp" command with my remote
smtp proivider?

The smtp server is smtp.infosaic.com.

Thanks

P.S. Nice Blog

Sep 24 '07 #12

P: n/a
Hello,

Yes, this links is an step by step guide to check if your remote SMTP is
working (using telnet):

http://msexchangeteam.com/archive/20...14/428324.aspx

good luck
Braulio

/// ------------------------------
/// Braulio Diez
///
/// http://www.tipsdotnet.com
/// ------------------------------


"bg********@yahoo.com" wrote:
>

Thank you very much. The SMTP server I use is on a remote system. Is
there a way to use the "telnet localhost smtp" command with my remote
smtp proivider?

The smtp server is smtp.infosaic.com.

Thanks

P.S. Nice Blog

Sep 25 '07 #13

P: n/a
Is there suppose to be a command in the code to tell the smtp service,
that you are finished using it?

Sep 25 '07 #14

P: n/a

http://sholliday.spaces.live.com/Blog/cns!A68482B9628A842A!138.entry

I have downloadable examples there.

See if you can get that to work, then work backwards from the example.

There are 3 different authentication modes for smtp. Maybe that's your
issue.
Look at the sample code to see what I mean by authentication modes.

<bg********@yahoo.comwrote in message
news:11**********************@w3g2000hsg.googlegro ups.com...
>

I have a form with the following fields:

UserEmail
Subject
Body

When the form is submitted, the email is processed fine. When I try
to add another field to the mm.body (mm.Body = Body.Text &
Listbox1.SelectedItem.Text) the smtp.Send fails. Any ideas ?
Code:

<script runat="server">
Protected Sub SendEmail_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles SendEmail.Click
'!!! UPDATE THIS VALUE TO YOUR EMAIL ADDRESS
Const ToAddress As String = "ab*@abc.com"

'(1) Create the MailMessage instance
Dim mm As New Net.Mail.MailMessage(UsersEmail.Text, ToAddress)

'(2) Assign the MailMessage's properties
mm.Subject = Subject.Text
mm.Body = Body.Text & TextBox1.Text
mm.IsBodyHtml = False

'(3) Create the SmtpClient object
Dim smtp As New Net.Mail.SmtpClient

'(4) Send the MailMessage (will use the Web.config settings)
smtp.Send(mm)
End Sub
</script>

Sep 25 '07 #15

P: n/a
I checked out your samples. I am having a problem with:

authenicationMode="SSL"

I put this in my web.config mail settings and when I put the mouse
over it, i get the following message:

"The authenticationMode attribute is not declared"

Can you please help?

Sep 27 '07 #16

P: n/a

You are trying to mix my custom solution with the "out of the box"
configuration setup.

<bg********@gmail.comwrote in message
news:11**********************@19g2000hsx.googlegro ups.com...
>I checked out your samples. I am having a problem with:

authenicationMode="SSL"

I put this in my web.config mail settings and when I put the mouse
over it, i get the following message:

"The authenticationMode attribute is not declared"

Can you please help?

Sep 28 '07 #17

This discussion thread is closed

Replies have been disabled for this discussion.