public string ActivtionEmail(ulong User_ID, string UserEmail, string url, string type = "user") { string Template = GetEmailTempalte(); EncDec key = new EncDec(); StringBuilder sb = new StringBuilder(); MailMessage Message = new MailMessage(); Message.To.Add(UserEmail); Message.IsBodyHtml = true; Message.Subject = "Account Activation"; Message.Priority = MailPriority.High; sb.Append("An account was set up on Apppointments365.com using your email address.<br/><br/>"); sb.Append("<a href='http://" + url + "/account/Activate?id=" + key.enc(User_ID.ToString()) + "&type=" + type + "&email=" + key.enc(UserEmail.ToString()) + "'target='_blank'>http://" + url + "/account/Activate?id=" + key.enc(User_ID.ToString()) + "&type=" + type + "&email=" + key.enc(UserEmail.ToString()) + "</a>"); sb.Append("<br/><br/>Email:" + UserEmail + "<br/>"); Template = Template.Replace("[subject]", "Account Activation"); Template = Template.Replace("[body]", sb.ToString()); Message.Body = Template; SmtpClient client = new SmtpClient("smtp.gmail.com", 587); try { client.EnableSsl = true; client.DeliveryMethod = SmtpDeliveryMethod.Network; client.Credentials = new System.Net.NetworkCredential("*****@*****.**", "dssdproject"); client.Send(Message); return(null); } catch (Exception exp) { return(exp.Message); } }