Skip to content

Email templates

santosh kumar

Asked Aug 28, 2007, 8:50 AM EDT1 answer
Share
LinkedInX
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.

  • 0
     

    Hi,

    Hope this helps.

     

    TypeScript
    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);
    }
    }
    0