MailMessageEventArgs.Message Properti
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Mendapatkan konten pesan email.
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
Nilai Properti
yang MailMessage berisi konten pesan.
Contoh
Contoh kode berikut menunjukkan cara menggunakan Message properti dalam penanganan aktivitas pesan email untuk mengubah konten pesan sebelum dikirim.
<%@ 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>
Keterangan
Properti Message mengembalikan MailMessage objek yang berisi data pesan email. Properti Message bersifat baca-saja; namun, Anda dapat menggunakan MailMessage objek yang dikembalikannya untuk mengubah properti pesan email.