Email templates
Hi.,please any one give me some basic idea about coding email templates in C#.net
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Raghu8 pointsPosted Aug 28, 2007, 9:45 AM EDT
Hi,
Hope this helps.
public void sendEmail(string thisEmailBody) { MailMessage thisMail = new MailMessage(); thisMail.To = toAddr@abc.com thisMail.From = from@site.com; thisMail.Subject = "subject line here"; thisMail.Body = thisEmailBody; thisMail.Fields["http://schemas.microsoft.com/cdo/configuration/sendusing"] = 2; thisMail.Fields["http://schemas.microsoft.com/cdo/configuration/smtpserver"] = "mail.smptserver.com"; thisMail.Fields["http://schemas.microsoft.com/cdo/configuration/sendusername"] = "[email protected]"; thisMail.Fields["http://schemas.microsoft.com/cdo/configuration/sendpassword"] = "password"; thisMail.Fields["http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"] = 1; System.Web.Mail.SmtpMail.SmtpServer = "mail.smptserver.com"; (change this url) try { System.Web.Mail.SmtpMail.Send(thisMail); } catch(Exception Ex) { Response.Write("Unable to Send the Email!!! " + Ex.Message); } }