I tried to send a simple mail without attachment by gmail server.
But it does'nt work.
I tried to send it by port 485 with SSL, and by port 587 with TLS but no one is working.
Can you give me a valid source code to send a simple mail with a gmail account.
Jul 16, 2010 at 4:16 PM
It seems port no is wrong.Port no is 465.
Here is a complete code work with GMail ssl.
SmtpClient cl = new SmtpClient();
cl.ServerName = "smtp.gmail.com";
cl.Port = 465;
cl.Ssl = true;
cl.AuthenticateMode = SmtpAuthenticateMode.Auto;
cl.UserName = "email@example.com";
cl.Password = "yourPassword";
SmtpMessage mg = new SmtpMessage();
mg.From = "firstname.lastname@example.org";
mg.Subject = "GMail test";
mg.BodyText = "GMail test body";
var rs = cl.SendMail("<email@example.com>", "<firstname.lastname@example.org>", "", "", mg.GetDataText());