4
Reply

send email using c# in windows application

Zuber Kazi

Zuber Kazi

Apr 16 2012 8:21 AM
5.4k
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)