472,106 Members | 1,352 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,106 software developers and data experts.

"Failure Sending Mail" when using System.Net.Mail and ASP.Net 2.0

I am working on getting my web applications moved to .Net 2.0 and am
having some problems with System.Net.Mail. I get the following error
when sending the mail:

System.Net.Mail.SmtpException was unhandled by user code
Message="Failure sending mail."
Source="System"
StackTrace:
at System.Net.Mail.SmtpClient.Send(MailMessage message)
at System.Net.Mail.SmtpClient.Send(String from, String
recipients, String subject, String body)
at emailtest.Page_Load(Object sender, EventArgs e) in ******
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

And the innerexception shows:

"The token supplied to the function is invalid"
My 1.1 application works fine with the settings below. Here is the code
I am using in 2.0:

Dim SmtpClient As New System.Net.Mail.SmtpClient
SmtpClient.Host = "MAILSERVER"
SmtpClient.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.Network
SmtpClient.Credentials = New
System.Net.NetworkCredential("username", "pass")
SmtpClient.Send("FROM", "TO", "Test Sub", "test Body")

On my server I am running Kerio mailserver 6.1.1. I require
authentication when sending SMTP. The usernames are in the format of
us******@domainname.com. The SMTP server is on the standard port 25.

I have seen similiar posts on the internet but no resolution. Why would
this work in framework 1.1 and not in 2.0? And since I cannot find any
3rd party componenets for 2.0 yet, I am forced to work through this
issue.

Any help would be much appreciated.

Dec 4 '05 #1
3 57321
Have you tried to add the credentials to your web.config?

--
Daniel Fisher(lennybacon)
http://www.lennybacon.com
<Ho****************@gmail.com> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...
I am working on getting my web applications moved to .Net 2.0 and am
having some problems with System.Net.Mail. I get the following error
when sending the mail:

System.Net.Mail.SmtpException was unhandled by user code
Message="Failure sending mail."
Source="System"
StackTrace:
at System.Net.Mail.SmtpClient.Send(MailMessage message)
at System.Net.Mail.SmtpClient.Send(String from, String
recipients, String subject, String body)
at emailtest.Page_Load(Object sender, EventArgs e) in ******
at System.Web.UI.Control.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

And the innerexception shows:

"The token supplied to the function is invalid"
My 1.1 application works fine with the settings below. Here is the code
I am using in 2.0:

Dim SmtpClient As New System.Net.Mail.SmtpClient
SmtpClient.Host = "MAILSERVER"
SmtpClient.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.Network
SmtpClient.Credentials = New
System.Net.NetworkCredential("username", "pass")
SmtpClient.Send("FROM", "TO", "Test Sub", "test Body")

On my server I am running Kerio mailserver 6.1.1. I require
authentication when sending SMTP. The usernames are in the format of
us******@domainname.com. The SMTP server is on the standard port 25.

I have seen similiar posts on the internet but no resolution. Why would
this work in framework 1.1 and not in 2.0? And since I cannot find any
3rd party componenets for 2.0 yet, I am forced to work through this
issue.

Any help would be much appreciated.

Dec 5 '05 #2
I hadn't tried that so I just tried using the following in my
web.config. No go though, got the same error. On a side note I can send
through gmail's smtp service using their alternate port and SSL.
Although in my cirumstance I am just trying to send a regular email
using authentication.

<system.net>
<mailSettings>
<smtp deliveryMethod="network" from="us**@domain.com">
<network
host="localhost"
password="****"
userName="us**@domain.com"
port="25"
/>
</smtp>
</mailSettings>
</system.net>

Dec 5 '05 #3
Try looking for a solution at:-
http://www.systemwebmail.com/
It should guide you
Patrick

"HoustonComputerGuy" <Ho****************@gmail.com> wrote in message
news:11********************@g49g2000cwa.googlegrou ps.com...
I hadn't tried that so I just tried using the following in my
web.config. No go though, got the same error. On a side note I can send
through gmail's smtp service using their alternate port and SSL.
Although in my cirumstance I am just trying to send a regular email
using authentication.

<system.net>
<mailSettings>
<smtp deliveryMethod="network" from="us**@domain.com">
<network
host="localhost"
password="****"
userName="us**@domain.com"
port="25"
/>
</smtp>
</mailSettings>
</system.net>

Dec 6 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Mike Logan | last post: by
94 posts views Thread by Samuel R. Neff | last post: by
1 post views Thread by =?Utf-8?B?VGFsYWxTYWxlZW0=?= | last post: by
reply views Thread by leo001 | last post: by

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.