السلام عليكم
iam just try to develope a web application with asp.net 2.0 to send emails usin smtp.gmail.com
i found the same code in several sites ... but it just doesnot work with me
this is the code
MailMessage mailMsg = new MailMessage();
mailMsg.From = new MailAddress("3la2.lafi[a.t]gmail[d.o.t]com");
mailMsg.To.Add( new MailAddress("j_taslaq[a.t]yahoo[d.o.t]com"));
mailMsg.Subject = "subject";
mailMsg.IsBodyHtml = true;
mailMsg.BodyEncoding = Encoding.UTF8;
mailMsg.Body = "Gmail web application test";
mailMsg.Priority = MailPriority.Normal;
// Smtp configuration
SmtpClient client = new SmtpClient();
client.Credentials = new NetworkCredential("3la2.lafi[a.t]gmail[d.o.t]com", "MyPassword");
client.Port = 25; //or use 465
client.Host = "smtp.gmail.com";
client.EnableSsl = true;
object userState = mailMsg;
try
{
//you can also call client.Send(msg)
client.Send(mailMsg);
}
catch (SmtpException ex)
{
TextBox1.Text = ex.GetBaseException().ToString();
}
**********************
and this is the exception
System.Net.Sockets.SocketException: 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 66.249.91.109:25.. etc
is ther any solution
or any other way to send emails via web application???
with my all respect

