email templates
Hi.,please any one give me some basic idea about coding email templates in C#.net
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
RaghuPosted Aug 28, 2007, 1:45 PM
Hi,
Hope this helps.
public void sendEmail(string thisEmailBody)
{
MailMessage thisMail = new MailMessage();
thisMail.To = [email protected]
thisMail.From = [email protected];
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);
}
}