//Send mail
string code = user.ProviderUserKey.ToString();
System.Net.Mail.SmtpClient sc = new SmtpClient();
sc.Host = ConfigurationManager.AppSettings["MySmtp"].ToString();
string mf = ConfigurationManager.AppSettings["MailFrom"].ToString();
string mt = ConfigurationManager.AppSettings["MailTo"].ToString();
MailMessage mm = new MailMessage(mf,mt);
MailAddress mr = new MailAddress(ConfigurationManager.AppSettings["MailReplyTo"].ToString());
mm.IsBodyHtml = Convert.ToBoolean(Convert.ToInt16(ConfigurationManager.AppSettings["MailIsBodyHTML"].ToString()));
mm.ReplyTo = mr;
mm.Subject = ConfigurationManager.AppSettings["MailSubject"].ToString();
//Body
string strList = "";
string[] array = System.IO.File.ReadAllLines(Server.MapPath(".") + "/" + ConfigurationManager.AppSettings["BodyByFile"].ToString());
for (int i = 0; i < array.Length - 1; i++)
{
strList += array[i].ToString();
}
strList = strList.Replace("<% UserName %>", user.UserName.ToString()).Replace("<% Email %>", user.Email.ToString()).Replace("<% FirstName %>", pc.FirstName.ToString()).Replace("<% LastName %>", pc.LastName.ToString()).Replace("<% Company %>", pc.Company.ToString());
strList = strList.Replace("<% Address %>", pc.Address.ToString()).Replace("<% WebSite %>", pc.WebSite.ToString()).Replace("<% Country %>", pc.Country.ToString()).Replace("<% City %>", pc.City.ToString()).Replace("<% State %>", pc.State.ToString());
strList = strList.Replace("<% Phone %>", pc.Phone.ToString()).Replace("<% Mobile %>", pc.Mobile.ToString()).Replace("<% ConfirmationCode %>", user.ProviderUserKey.ToString()).ToString();
mm.Body = strList;
sc.Send(mm);
sc = null;