1: void sendEmail(string strFrom, string strTo, string strSubject, string strBody)
2: {
3: System.Net.Mail.MailMessage objMailMessage
= new System.Net.Mail.MailMessage();
4: objMailMessage.To.Add(strTo);
5: objMailMessage.From
= new MailAddress(strFrom, "", System.Text.Encoding.UTF8);
6: objMailMessage.Subject = strSubject;
7: objMailMessage.SubjectEncoding = System.Text.Encoding.UTF8;
8: objMailMessage.Body = strBody;
9: objMailMessage.BodyEncoding = System.Text.Encoding.UTF8;
10: objMailMessage.IsBodyHtml = true;
11: objMailMessage.Priority = MailPriority.High;
12:
13: SmtpClient objSmtpClient = new SmtpClient();
14:
15: objSmtpClient.Credentials = new System.Net.NetworkCredential(strFrom, "");
16:
17: objSmtpClient.Host = "smtp.gmail.com";
18: objSmtpClient.Port = 587;
19: objSmtpClient.EnableSsl = true;
20:
21: objSmtpClient.Send(objMailMessage);
22: }