send mail using gmail smtp server
try
{
MailMessage mm = new MailMessage(From.Trim(),To);
mm.BodyEncoding = Encoding.UTF7;
mm.Subject = Subject.Trim();
mm.Body = MessageTxt.Trim() + "\n";
mm.Priority = MailPriority.High;
mm.IsBodyHtml = false;
if (FileSt != "")
{
Attachment msgAtt = new Attachment(FileSt);
mm.Attachments.Add(msgAtt);
}
SmtpClient sc = new SmtpClient();
sc.Credentials = new System.Net.NetworkCredential("sudesh.withanage", "priyanka");
sc.Port = 587;
sc.Host = "smtp.gmail.com";
sc.EnableSsl = true;
// sc.SendCompleted +=new SendCompletedEventHandler();
sc.Send(mm);
MessageBox.Show("success");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
gmail pop
pop.gmail.com
995
gmail smtp
587
smtp.gmail.com