Zuber Kazi

Zuber Kazi

  • NA
  • 36
  • 34.3k

send email using c# in windows application

Apr 16 2012 8:21 AM
Hello Everyone,
I want to send email using c# in windows application.
i used snippet as following

System.Net.Mail.MailMessage mes = new System.Net.Mail.MailMessage();
mes.To.Add("[email protected]");
mes.Subject = "none";
mes.From = new System.Net.Mail.MailAddress("[email protected]");
mes.Body = "test";
System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("smtp.gmail.com");
smtp.Port = 578;
smtp.Send(mes);

but it throws an smtp error
Please help me out.
If u have other snippet then please post it.

Regards,
Zuber Isak Kazi



Answers (4)