Easy Tutorial
❮ Aspnet Textbox Prop Webcontrol Panel Horizontalalign ❯

ASP.NET Web Pages - WebMail Helper


WebMail Helper - One of the many useful ASP.NET Web Helpers.


WebMail Helper

The WebMail Helper makes sending emails easier, sending emails from your web application via SMTP (Simple Mail Transfer Protocol).


Prerequisite: Email Support

To demonstrate how to use email, we will create an input page that allows users to submit a page to another page and send an email about a support issue.


Step One: Edit Your AppStart Page

If you have created a Demo application in this tutorial, you already have a page named _AppStart.cshtml with the following content:

_AppStart.cshtml

To initialize the WebMail Helper, add the following WebMail properties to your AppStart page:

_AppStart.cshtml

WebMail.SmtpServer = "smtp.example.com"; WebMail.SmtpPort = 25; WebMail.EnableSsl = false; WebMail.UserName = "[email protected]"; WebMail.Password = "password-goes-here"; WebMail.From = "[email protected]";

Property Explanation:

SmtpServer: The name of the SMTP server used to send emails.

SmtpPort: The port that the server uses to send SMTP transactions (emails).

EnableSsl: True if the server uses SSL (Secure Socket Layer) encryption.

UserName: The name of the SMTP email account used to send emails.

Password: The password for the SMTP email account.

From: The email displayed in the sender's address field (usually the same as UserName).


Step Two: Create an Email Input Page

Next, create an input page and name it Email_Input:

Email_Input.cshtml

The purpose of the input page is to collect information and then submit the data to a new page that can send the information as an email.


Step Three: Create an Email Sending Page

Next, create a page for sending emails and name it Email_Send:

Email_Send.cshtml

For more information on sending emails in ASP.NET Web Pages applications, please refer to: WebMail Object Reference.

❮ Aspnet Textbox Prop Webcontrol Panel Horizontalalign ❯