Re: Using System.Net.Mail

Christopher Reed <[email protected]>
Newsgroups gmane.comp.windows.devel.dotnet.web
Message-ID <!&!AAAAAAAAAAAYAAAAAAAAAK6K8FKU4upCsxVkk3FrEarCgAAAEAAAACmtp32Ys21Ot8tBs/[email protected]>
Typical, I find that the anti-virus software on the SMTP server is blocking port
25.  If you SMTP server is different from when you use System.Web.Mail and
System.Net.Mail, then look at your virus scanner settings.

--------------------------------------------------------------------------------
---
Christopher Reed
"The oxen are slow, but the earth is patient."


>|-----Original Message-----
>|From: Discussion of building .NET applications targeted for the Web
[mailto:[email protected]] On Behalf Of Clark, Michael (OFM)
>|Sent: Friday, May 04, 2007 12:55 PM
>|To: [email protected]
>|Subject: [DOTNET-WEB] Using System.Net.Mail
>|
>|
>|I'm going out of my mind trying to get System.Net.Mail to work in an app, but
am having no joy.  I was using System.Web.Mail, and the following code works
like a charm:
>|
>|MailMessage mm = new MailMessage()
>|mm.To = "[email protected]";
>|mm.From = "[email protected]";
>|mm.Body = "Just testing this";
>|mm.Subject = "Testing 123";
>|
>|SmtpMail.Send(mm);
>|
>|VS2005 says it's obsolete, so I'm trying to use the "new and improved"
methods.
>|
>|I look at the sample code in MSDN on using the Send method in
System.Net.Mail.SmtpClient as found here:
>|
>|http://msdn2.microsoft.com/en-us/library/swas0fwc.aspx
>|
>|And the code that I am attempting to execute is:
>|
>|string to = "[email protected]";
>|string from = "[email protected]";
>|MailMessage message = new MailMessage(from, to);
>|message.Subject = "Using the new SMTP client.";
>!message.Body = @"Using this new feature, you can send an e-mail message from
an application very easily.";
>!SmtpClient client = new SmtpClient(Server);
>!client.UseDefaultCredentials = true;
>|client.Send(message);
>|
>|When the Send is executed this exception is raised: "An established connection
was aborted by the software in your host machine "
>|
>|Looking further, the status code given is "GeneralFailure", the exception
message is "Failure sending mail." and the inner exception message is "Unable to
connect to the remote server".
>|
>|The problem may or may not be centered around the server name.  It's a server
on our intranet, and I have tried both its name and its IP address, but no joy.

>|
>|Does anyone have any suggestions?

No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.467 / Virus Database: 269.6.5/792 - Release Date: 5/6/2007 9:01 PM

===================================
This list is hosted by DevelopMentor®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.