473,387 Members | 1,771 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 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 57566
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Steven K | last post by:
Hello, I am using an asp page (upload.asp) to gather information and to upload files to the web server using SoftArtisans SAUpload Tool. In the first page (upload.asp), I have a form for...
10
by: serge | last post by:
Using "SELECT * " is a bad practice even when using a VIEW instead of a table? I have some stored procedures that are identical with the difference of one statement in the WHERE clause. If I...
8
by: Just Me | last post by:
1)How can I find the folders like "My Recent Document", "Desktop", "My Pictures",... if I want to store a file there? 2) How can I find the icon for those files if I want to display it? ...
2
by: JohnB | last post by:
hi I am using System.Web.Mail.MailMessage to send email. Is there any way to keep the email to "Sent Items" Folder?? I use Microsoft Outlook as my email tool. Thanks
5
by: Mike Logan | last post by:
I used WSDL.exe to generate a client side web proxy for a web service, called the web service, got the results but an array returned by the web service is not in the results. However if I use...
94
by: Samuel R. Neff | last post by:
When is it appropriate to use "volatile" keyword? The docs simply state: " The volatile modifier is usually used for a field that is accessed by multiple threads without using the lock...
0
by: Hollywood | last post by:
Good day dear members of the comp.databases.ms-access newsgroup. I'm using the new Acess 2007 "Collect data by using e-mail messages" functionality but it seems the generated e-mail by Outlook...
2
by: shil | last post by:
Hi all, I'm using System.Net.Mail (Framework 2.0) to send emails on scheduled basis. This works great on Windows 2000 server. Rently we have upgraded our servers to Windows 2003. Since then some...
1
by: =?Utf-8?B?VGFsYWxTYWxlZW0=?= | last post by:
i have facility in my website which sends an e-mail to the cleint's inbox..... i am getting a problem when ever i sends an e-mail.. i tried with Hotmail and Yahoo, e-mail goes to the "Junk Mail"...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.