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 = "firstname.lastname@example.org";
cl.Password = "yourPassword";
SmtpMessage mg = new SmtpMessage();
mg.From = "email@example.com";
mg.Subject = "GMail test";
mg.BodyText = "GMail test body";
var rs = cl.SendMail("<firstname.lastname@example.org>", "<email@example.com>", "", "", mg.GetDataText());