473,511 Members | 14,951 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

smtp.Send fail



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
16 2969
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
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

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
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
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
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
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
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

<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


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
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
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
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

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
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

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2797
by: Dan Boyle | last post by:
Hi, I am having difficulty connection to an smtp host. I am using the following code but I don't think I fully understand what smtp host can be used. function setSMTPParams($host = null,...
34
18143
by: antonyliu2002 | last post by:
I've set up the virtual smtp server on my IIS 5.1 like so: 1. Assign IP address to "All Unassigned", and listen to port 25. 2. Access Connection granted to "127.0.0.1". 3. Relay only allow...
3
1695
by: piercy | last post by:
is there a way to verify a SMTP server? for instance. my users specify the SMTP server depending on there local settings. if they put in a wrong smtp address it will still attempt to send the...
2
1836
by: Bgreer5050 | last post by:
I posted a problem with sending email via smtp using Dot Net 2.0 I was told to look at adding authentication to my web.config file; I added the following: authenticationMode="SSL" I put...
9
1267
by: Keith G Hicks | last post by:
I have a vb app that runs on a server. It periodically checks for rows in a table that are ready to have data mailed out to clients. After it finds row(s) that are ready, it emails the info out and...
0
7237
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7349
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7074
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5659
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5063
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4734
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3210
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1572
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.