/// This Function is used to send a Mail
///
/// Mail From
/// Mail To
/// Mail CC
/// Mail Subject
/// Mail Boday
public void sendemail(String MailFrom,String MailTo,String MailCC,String MailSubject,String MailBody)
{
System.Net.Mail.MailMessage tmail = new System.Net.Mail.MailMessage(MailFrom, strTO);
tmail.CC.Add(MailCC);
tmail.IsBodyHtml = true;
tmail.CC.Add(MailCC);
tmail.Subject = MailSubject;
tmail.Body = MailBody;
System.Net.Mail.SmtpClient sclient = new System.Net.Mail.SmtpClient();
System.Net.NetworkCredential basicAuthenticationInfo = new System.Net.NetworkCredential("UserName", "Password");
sclient.Host = "Mailserver";
sclient.UseDefaultCredentials = false;
sclient.Credentials = basicAuthenticationInfo;
sclient.Send(tmail);
}
No comments:
Post a Comment