Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > "Failure Sending Mail" when using System.Net.Mail and ASP.Net 2.0

Reply
Thread Tools

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

 
 
HoustonComputerGuy@gmail.com
Guest
Posts: n/a
 
      12-04-2005
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
http://www.velocityreviews.com/forums/(E-Mail Removed). 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.

 
Reply With Quote
 
 
 
 
Daniel Fisher\(lennybacon\)
Guest
Posts: n/a
 
      12-05-2005
Have you tried to add the credentials to your web.config?

--
Daniel Fisher(lennybacon)
http://www.lennybacon.com


<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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
> (E-Mail Removed). 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.
>



 
Reply With Quote
 
 
 
 
HoustonComputerGuy
Guest
Posts: n/a
 
      12-05-2005
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="(E-Mail Removed)">
<network
host="localhost"
password="****"
userName="(E-Mail Removed)"
port="25"
/>
</smtp>
</mailSettings>
</system.net>

 
Reply With Quote
 
Patrick.O.Ige
Guest
Posts: n/a
 
      12-06-2005
Try looking for a solution at:-
http://www.systemwebmail.com/
It should guide you
Patrick

"HoustonComputerGuy" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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="(E-Mail Removed)">
> <network
> host="localhost"
> password="****"
> userName="(E-Mail Removed)"
> port="25"
> />
> </smtp>
> </mailSettings>
> </system.net>
>



 
Reply With Quote
 
mpls mpls is offline
Junior Member
Join Date: Sep 2007
Posts: 1
 
      09-28-2007
I'm having the same problem when I set my smpt server to require authentication, my code does not return any exemptions but no email will go???? p.s. I can use outlook (not outlook express) on the same machine I'm testing on and it works. i check the SPA on the outlook account , outlook express does not work (( i'm starting to pull my hair on this one, please help!
thanks
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How to add CC and BCC while sending mails using python Bernhard Walle Python 2 11-30-2012 01:30 AM
Using ASPThumb and Sending Back from a Function/Sub MU ASP .Net 0 10-22-2008 04:39 PM
problem sending mail: Sending the email to the following server failed Luke Java 2 03-15-2007 10:54 AM
pls help me when i sent mail, it vil sending twice instead of once ,am using java.mail,am sending my code.... shailajabtech@gmail.com Java 0 09-28-2006 06:38 AM
Sending information from an ASPX page to ASP page using form and post method Ricardo Magalhaes ASP .Net 0 06-03-2005 02:37 PM



Advertisments