MailMessageEventArgs.Message Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets the email message contents.
public:
property System::Net::Mail::MailMessage ^ Message { System::Net::Mail::MailMessage ^ get(); };
public System.Net.Mail.MailMessage Message { get; }
member this.Message : System.Net.Mail.MailMessage
Public ReadOnly Property Message As MailMessage
Property Value
A MailMessage containing the message contents.
Examples
The following code example demonstrates how to use the Message property in an email message event handler to change the contents of the message before it is sent.
<%@ page language="C#" %>
<%@ Import namespace="Samples.AspNet.CS.Controls" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
void Page_Init(object sender, EventArgs e)
{
PasswordRecoveryOnBeforeSendingEmail passwordRecoveryControl =
new PasswordRecoveryOnBeforeSendingEmail();
passwordRecoveryControl.ID = "passwordRecoveryControl";
passwordRecoveryControl.MailDefinition.From = "userAdmin@your.site.name.here";
PlaceHolder1.Controls.Add(passwordRecoveryControl);
}
</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>
<%@ 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>
Remarks
The Message property returns the MailMessage object that contains the email message data. The Message property is read-only; however, you can use the MailMessage object that it returns to modify the properties of the email message.
Applies to
See also
.NET
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기