W
Wells Wang
Hi, Everybody:
Sorry to bother you.
I am trying to use the code below to send an email with asp.net2.0& win
XP. But it failed. On my laptop I can use outlook2003 to send email. If
you are avaiable, could you help me figure it out(or test it on you
computer).
I am looking forward to getting any feedback from you.I can be reached
at (e-mail address removed).
Thanks in advance and have a nice weekend.
Wells
======== source code ==============================
SmtpClient smtp = new SmtpClient();
smtp.Host = ¡°smtp.gmail.com¡±;
smtp.Port = 465;
smtp.Credentials = new System.Net.NetworkCredential(¡±uid¡±, ¡°pwd¡±);
smtp.EnableSsl = true;
System.Net.Mail.MailMessage message = new
MailMessage(¡±[email protected]¡±, ¡°[email protected]¡±, ¡°Subject¡±,
¡°Body¡±);
message.BodyEncoding = System.Text.Encoding.UTF8;
message.IsBodyHtml = true;
try
{
smtp.Send(message);
Response.Write(¡±Email successfully sent.¡±);
}
catch (Exception ex)
{
Response.Write(¡±Send Email Failed.¡± + ex.ToString()); ;
}
======== Exception ====================================
Send Email Failed.System.Net.Mail.SmtpException: The operation has timed
out. at System.Net.Mail.SmtpClient.Send(MailMessage message) at
MainPage.Button1_Click(Object sender, EventArgs e) in c:\Programming in
Class\ThreePages\MainPage.aspx.cs:line 111
Sorry to bother you.
I am trying to use the code below to send an email with asp.net2.0& win
XP. But it failed. On my laptop I can use outlook2003 to send email. If
you are avaiable, could you help me figure it out(or test it on you
computer).
I am looking forward to getting any feedback from you.I can be reached
at (e-mail address removed).
Thanks in advance and have a nice weekend.
Wells
======== source code ==============================
SmtpClient smtp = new SmtpClient();
smtp.Host = ¡°smtp.gmail.com¡±;
smtp.Port = 465;
smtp.Credentials = new System.Net.NetworkCredential(¡±uid¡±, ¡°pwd¡±);
smtp.EnableSsl = true;
System.Net.Mail.MailMessage message = new
MailMessage(¡±[email protected]¡±, ¡°[email protected]¡±, ¡°Subject¡±,
¡°Body¡±);
message.BodyEncoding = System.Text.Encoding.UTF8;
message.IsBodyHtml = true;
try
{
smtp.Send(message);
Response.Write(¡±Email successfully sent.¡±);
}
catch (Exception ex)
{
Response.Write(¡±Send Email Failed.¡± + ex.ToString()); ;
}
======== Exception ====================================
Send Email Failed.System.Net.Mail.SmtpException: The operation has timed
out. at System.Net.Mail.SmtpClient.Send(MailMessage message) at
MainPage.Button1_Click(Object sender, EventArgs e) in c:\Programming in
Class\ThreePages\MainPage.aspx.cs:line 111