public void SendEmail(string Server, string SmtpUser, string SmtpPassword,string To, string From,
string Body, string Subject,string CC,string BCC)
{
System.Web.Mail.SmtpMail.SmtpServer = Server;
System.Web.Mail.MailMessage mssg = new System.Web.Mail.MailMessage();
mssg.BodyFormat = System.Web.Mail.MailFormat.Html;
mssg.Body = Body;
mssg.Subject = Subject;
mssg.To = To;
mssg.From = From;
if(BCC.Trim().Length > 0)
mssg.Bcc = BCC.Trim();
if(CC.Trim().Length > 0)
mssg.Cc = CC.Trim();
//Set the SMTP authentication
mssg.Fields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"] = 1;
if(SmtpUser.Trim().Length > 0)
mssg.Fields["http://schemas.microsoft.com/cdo/configuration/sendusername"] = SmtpUser.Trim();
if(SmtpPassword.Trim().Length > 0)
mssg.Fields["http://schemas.microsoft.com/cdo/configuration/sendpassword"] = SmtpPassword.Trim();
//send the email
System.Web.Mail.SmtpMail.Send(mssg);
}