Message Property
Collapse the table of content
Expand the table of content

MailMessageEventArgs.Message Property


Gets the e-mail message contents.

Namespace:   System.Web.UI.WebControls
Assembly:  System.Web (in System.Web.dll)

Public ReadOnly Property Message As MailMessage

Property Value

Type: System.Net.Mail.MailMessage

A MailMessage containing the message contents.

The Message property returns the MailMessage object that contains the e-mail message data. The Message property is read-only; however, you can use the MailMessage object that it returns to modify the properties of the e-mail message.

The following code example demonstrates how to use the Message property 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"
<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 = ""

  End Sub


<html xmlns="" >
  <head runat="server">
    <title>ASP.NET Example</title>
    <form id="form1" runat="server">
      <asp:placeholder id="PlaceHolder1" runat="server"></asp:placeholder>

.NET Framework
Available since 2.0
Return to top
© 2016 Microsoft