MailMessageEventArgs Class
.NET Framework 3.0
Provides data for e-mail–related events.
Namespace: System.Web.UI.WebControls
Assembly: System.Web (in system.web.dll)
Assembly: System.Web (in system.web.dll)
The MailMessageEventArgs class provides access to the MailMessage object that contains the e-mail message. Because the MailMessageEventArgs class is derived from the LoginCancelEventArgs class, you can cancel sending an e-mail message in your event handler by setting the Cancel property to true.
The following code example demonstrates how to use the MailMessageEventArgs class in an e-mail message event handler to change the contents of the message before it is sent.
<%@ page language="VB" %> <%@ Import namespace="Samples.AspNet.VB.Controls" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <script runat="server"> Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs) Dim passwordRecoveryControl As New PasswordRecoveryOnBeforeSendingEmail passwordRecoveryControl.ID = "passwordRecoveryControl" passwordRecoveryControl.MailDefinition.From = "userAdmin@your.site.name.here" PlaceHolder1.Controls.Add(passwordRecoveryControl) End Sub </script> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>ASP.NET Example</title> </head> <body> <form id="form1" runat="server"> <asp:placeholder id="PlaceHolder1" runat="server"></asp:placeholder> </form> </body> </html>
- AspNetHostingPermission for operating in a hosted environment. Demand value: LinkDemand; Permission value: Minimal.
- AspNetHostingPermission for operating in a hosted environment. Demand value: InheritanceDemand; Permission value: Minimal.
System.Object
System.EventArgs
System.Web.UI.WebControls.LoginCancelEventArgs
System.Web.UI.WebControls.MailMessageEventArgs
System.EventArgs
System.Web.UI.WebControls.LoginCancelEventArgs
System.Web.UI.WebControls.MailMessageEventArgs
Community Additions
ADD
Show: