The WebMail Helper - One of many useful ASP.NET Web Helpers.
The WebMail Helper makes it easy to send an email from a web application using SMTP (Simple Mail transfer Protocol).
To demonstrate the use of email, we will create an input page for support, let the user submit the page to another page, and send an email about the support problem.
If you have built the Demo application in this tutorial, you already have a page called _AppStart.cshtml with the following content:
To initiate the WebMail helper, add the the following WebMail properties to your AppStart page:
Properties explained:
SmtpServer: The name the SMTP server that will be used to send the emails.
SmtpPort: The port the server will use to send SMTP transactions (emails).
EnableSsl: True, if the server should use SSL (Secure Socket Layer) encryption.
UserName: The name of the SMTP email account used to send the email.
Password: The password of the SMTP email account.
From: The email to appear in the from address (often the same as UserName).
Then create an input page, and name it Email_Input:
The purpose of the input page is to collect information, then submit the data to a new page that can send the information as an email.
Then create the page that will be used to send the email, and name it Email_Send:
For more information about sending emails from a ASP.NET Web Pages application, please see the: WebMail Object Reference.