Monday 3 February 2014

MVC 4 - Example sending email - WebMail

Leave a Comment
This is a example of sending email snippet code in Razor Editor.

Sample Sending Email - Razor

 
@{
Layout = null;
}
<!DOCTYPE html>
 <html>
  <head>
   <meta name="viewport" content="width=device-width" />
   <title>Thanks</title>
  </head>
<body>
     @{
       try {
         WebMail.SmtpServer = "smtp.example.com";
         WebMail.SmtpPort = 587;
         WebMail.EnableSsl = true;
         WebMail.UserName = "mySmtpUsername";
         WebMail.Password = "mySmtpPassword";
         WebMail.From = "rsvps@example.com";
         WebMail.Send("party-host@example.com", "RSVP Notification",
                 "Message Send will be here");
       } 
      catch (Exception) 
      {
          @:<b>Sorry - we couldn't send the email to confirm your RSVP.</b>
       }
     }
<div>
</div>
</body>
</html>


By
NOTE : – If You have Found this post Helpful, I will appreciate if you can Share it on Facebook, Twitter and Other Social Media Sites. Thanks =)

0 comments:

Post a Comment

Subscribe to our newsletter to get the latest updates to your inbox.

Your email address is safe with us!




Founder of developersnote.com, love programming and help others people. Work as Software Developer. Graduated from UiTM and continue study in Software Engineering at UTMSpace. Follow him on Twitter , or Facebook or .



Powered by Blogger.