Re: Unable to send mail using System.Net.Mail
- From: "Lau Lei Cheong" <leu_lc@xxxxxxxxxxxx>
- Date: Tue, 13 Sep 2005 16:02:36 +0800
Seems to be plain "Connection failed" message... Have you tried verify the
connection by typing "telnet <smtp server> 25"?
"Kaustav." <Kaustav.@xxxxxxxxxxxxxxxxxxxxxxxxx> ¼¶¼g©ó¶l¥ó·s»D:516BC632-EE44-4176-AB62-2F1A60B906D2@xxxxxxxxxxxxxxxx
> Hi,
>
> I am trying to send a mail using the System.Net.Mail namespace. My SMTP
> server requires authentication and the following is the code snippet which
> I've been using:
>
> MailMessage msg = new MailMessage();
> SmtpClient server = new SmtpClient();
> System.Net.NetworkCredential credentials = new
> System.Net.NetworkCredential(Username, Password);
>
> msg.From = new MailAddress(From, DisplayName);
> msg.To.Add(To);
> msg.CC.Add(Cc);
> msg.Bcc.Add(Bcc);
> msg.Subject = Subject;
> msg.Body = Body;
> msg.IsBodyHtml = true;
> server.Host = SMTPServer;
> server.UseDefaultCredentials = false;
> server.Credentials = credentials;
> server.Send(msg);
>
> I get an exception which says
>
> "A connection attempt failed because the connected party did not properly
> respond after a period of time, or established connection failed because
> connected host has failed to respond".
>
> I have tried increasing the timeout and that too didn't help. I am using
> VS
> 2005 Beta 2 on a W2K3 Server Standard Edition.
>
> Any inputs will be much appreciated. Thanks.
>
.
- References:
- Unable to send mail using System.Net.Mail
- From: Kaustav.
- Unable to send mail using System.Net.Mail
- Prev by Date: The publisher could not be verified
- Next by Date: The publisher could not be verified
- Previous by thread: Unable to send mail using System.Net.Mail
- Next by thread: return statement inside finally block
- Index(es):
Relevant Pages
|