MailMessage クラス
アセンブリ: System (system.dll 内)

Public Class MailMessage Implements IDisposable
public class MailMessage : IDisposable
public ref class MailMessage : IDisposable
public class MailMessage implements IDisposable
public class MailMessage implements IDisposable

MailMessage クラスのインスタンスは、SmtpClient クラスを使用して配信用 SMTP サーバーに送信される電子メール メッセージを作成するために使用されます。
電子メール メッセージの差出人、受信者、および内容を指定するには、MailMessage クラスの対応するプロパティを使用します。
From | |
受信者 | |
Attachments | |
AlternateViews プロパティを使用して、別の形式で電子メール メッセージのコピーを指定します。たとえば、HTML 形式でメッセージを送信する場合に、一部の受信者が HTML コンテンツを表示できない電子メール プログラムを使用しているときは、プレーン テキスト版も提供できます。別形式の表示内容を持つメッセージの作成例については、AlternateViews を参照してください。

添付データを含んだ電子メール メッセージの作成および送信を行うコード例を次に示します。
public static void CreateMessageWithAttachment(string server) { // Specify the file to be attached and sent. // This example assumes that a file named Data.xls exists in the // current working directory. string file = "data.xls"; // Create a message and set up the recipients. MailMessage message = new MailMessage( "jane@contoso.com", "ben@contoso.com", "Quarterly data report.", "See the attached spreadsheet."); // Create the file attachment for this e-mail message. Attachment data = new Attachment(file, MediaTypeNames.Application.Octet); // Add time stamp information for the file. ContentDisposition disposition = data.ContentDisposition; disposition.CreationDate = System.IO.File.GetCreationTime(file); disposition.ModificationDate = System.IO.File.GetLastWriteTime(file); disposition.ReadDate = System.IO.File.GetLastAccessTime(file); // Add the file attachment to this e-mail message. message.Attachments.Add(data); //Send the message. SmtpClient client = new SmtpClient(server); // Add credentials if the SMTP server requires them. client.Credentials = CredentialCache.DefaultNetworkCredentials; client.Send(message); // Display the values in the ContentDisposition for the attachment. ContentDisposition cd = data.ContentDisposition; Console.WriteLine("Content disposition"); Console.WriteLine(cd.ToString()); Console.WriteLine("File {0}", cd.FileName); Console.WriteLine("Size {0}", cd.Size); Console.WriteLine("Creation {0}", cd.CreationDate); Console.WriteLine("Modification {0}", cd.ModificationDate); Console.WriteLine("Read {0}", cd.ReadDate); Console.WriteLine("Inline {0}", cd.Inline); Console.WriteLine("Parameters: {0}", cd.Parameters.Count); foreach (DictionaryEntry d in cd.Parameters) { Console.WriteLine("{0} = {1}", d.Key, d.Value); } data.Dispose(); }

System.Net.Mail.MailMessage


Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


MailMessage クラス
アセンブリ: System.Web (system.web.dll 内)

<ObsoleteAttribute("The recommended alternative is System.Net.Mail.MailMessage. http://go.microsoft.com/fwlink/?linkid=14202")> _ Public Class MailMessage
[ObsoleteAttribute("The recommended alternative is System.Net.Mail.MailMessage. http://go.microsoft.com/fwlink/?linkid=14202")] public class MailMessage
[ObsoleteAttribute(L"The recommended alternative is System.Net.Mail.MailMessage. http://go.microsoft.com/fwlink/?linkid=14202")] public ref class MailMessage
/** @attribute ObsoleteAttribute("The recommended alternative is System.Net.Mail.MailMessage. http://go.microsoft.com/fwlink/?linkid=14202") */ public class MailMessage
ObsoleteAttribute("The recommended alternative is System.Net.Mail.MailMessage. http://go.microsoft.com/fwlink/?linkid=14202") public class MailMessage

<%-- This example shows how to send a mail message from a Web Forms page using the classes in the System.Web.Mail namespace. --%> <%@ IMPORT namespace="System.Web.Mail" %> <html> <script language=VB runat=server> Sub Page_Load() If Not IsPostback Then lblMsg1.Text="" txtTo.Text="john@contoso.com" txtFrom.Text="marsha@contoso.com" txtCc.Text="fred@contoso.com" txtBcc.Text="wilma@contoso.com" txtSubject.Text="Hello" txtBody.Text="This is a test message." txtAttach.Text="C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Sunset.jpg," _ & "C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Winter.jpg" txtBodyEncoding.Text = Encoding.ASCII.EncodingName txtBodyFormat.Text="HTML" txtPriority.Text="Normal" txtUrlContentBase.Text="http://www.contoso.com/images" txtUrlContentLocation.Text="http://www.contoso.com/images" ' Name of relay mail server in your domain. txtMailServer.Text="smarthost"' End If End Sub Sub btnSubmit_Click(ByVal sender As Object, ByVal e As EventArgs) Dim sTo As String, sFrom As String, sSubject As String, sBody As String Dim sAttach As String, sCc As String, sBcc As String, sBodyEncoding As String Dim sBodyFormat As String, sMailServer As String, sPriority As String Dim sUrlContentBase As String, sUrlContentLocation As String Dim iLoop1 As Integer sTo = Trim(txtTo.Text) sFrom = Trim(txtFrom.Text) sSubject = Trim(txtSubject.Text) sBody = Trim(txtBody.Text) sAttach = Trim(txtAttach.Text) sCc = Trim(txtCc.Text) sBcc = Trim(txtBcc.Text) sBodyFormat = Trim(txtBodyFormat.Text) sBodyEncoding = Trim(txtBodyEncoding.Text) sPriority = Trim(txtPriority.Text) sUrlContentBase = Trim(txtUrlContentBase.Text) sUrlContentLocation = Trim(txtUrlContentLocation.Text) sMailServer = Trim(txtMailServer.Text) Dim MyMail As MailMessage = New MailMessage() MyMail.From = sFrom MyMail.To = sTo MyMail.Subject = sSubject MyMail.Body = sBody MyMail.Cc = sCc MyMail.Bcc = sBcc MyMail.UrlContentBase = sUrlContentBase MyMail.UrlContentLocation = sUrlContentLocation Select Case txtBodyEncoding.Text Case Encoding.UTF7.EncodingName : MyMail.BodyEncoding = Encoding.UTF7 Case Encoding.UTF8.EncodingName : MyMail.BodyEncoding = Encoding.UTF8 Case Else : MyMail.BodyEncoding = Encoding.ASCII End Select Select Case UCase(sBodyFormat) Case "HTML" : MyMail.BodyFormat = MailFormat.Html Case Else : MyMail.BodyFormat = MailFormat.Text End Select Select Case UCase(sPriority) Case "HIGH" : MyMail.Priority = MailPriority.High Case "LOW" : MyMail.Priority = MailPriority.Low Case Else : MyMail.Priority = MailPriority.Normal End Select ' Build an IList of mail attachments. If sAttach<>"" Then Dim delim As Char = "," Dim sSubstr As String For Each sSubstr in sAttach.Split(delim) Dim myAttachment As MailAttachment = New MailAttachment(sSubstr) myMail.Attachments.Add(myAttachment) Next End If SmtpMail.SmtpServer = sMailServer SmtpMail.Send(MyMail) lblMsg1.Text="VB Message sent to " & MyMail.To End Sub Sub btnClear_Click(ByVal sender As Object, ByVal e As EventArgs) lblMsg1.Text="" txtTo.Text="" txtFrom.Text="" txtSubject.Text="" txtBody.Text="" txtAttach.Text="" txtBcc.Text="" txtCc.Text="" txtBodyEncoding.Text="" txtBodyFormat.Text="" txtPriority.Text="" txtUrlContentBase.Text="" txtUrlContentLocation.Text="" txtMailServer.Text="" btnSubmit.Text="Submit" End Sub </script> <p><h4>Send a new mail message:<h4></p> <Form method="Post" action="MailForm.aspx" runat=server> <table width="350" bgcolor="#FFFF99"> <tr> <td Align="Right"><b>To:</b></td> <td><Asp:Textbox id="txtTo" runat=server/></td> </tr> <tr> <h4><td Align="Right"><b>From:</b></td></h4> <td><Asp:Textbox id="txtFrom" runat=server/></td> </tr> <tr> <td Align="Right"><b>Subject:</b></td> <td><Asp:Textbox id="txtSubject" runat=server/></td> </tr> <tr> <td Align="Right"><b>MessageBody:</b></td> <td><Asp:Textbox id="txtBody" runat=server/></td> </tr> <tr> <td Align="Right"><b>Attachments:</b></td> <td><Asp:Textbox id="txtAttach" runat=server/></td> </tr> <tr> <td Align="Right"><b>CC:</b></td> <td><Asp:Textbox id="txtBcc" runat=server/></td> </tr> <tr> <td Align="Right"><b>BCC:</b></td> <td><Asp:Textbox id="txtCc" runat=server/></td> </tr> <tr> <td Align="Right"><b>BodyEncoding:</b></td> <td><Asp:Textbox id="txtBodyEncoding" runat=server/></td> </tr> <tr> <td Align="Right"><b>BodyFormat:</b></td> <td><Asp:Textbox id="txtBodyFormat" runat=server/></td> </tr> <tr> <td Align="Right"><b>Priority:</b></td> <td><Asp:Textbox id="txtPriority" runat=server/></td> </tr> <tr> <td Align="Right"><b>URL Content Base:</b></td> <td><Asp:Textbox id="txtUrlContentBase" runat=server/></td> </tr> <tr> <td Align="Right"><b>URL Content Location:</b></td> <td><Asp:Textbox id="txtUrlContentLocation" runat=server/></td> </tr> <tr> <td Align="Right"><b>Mail Server:</b></td> <td><Asp:Textbox id="txtMailServer" runat=server/></td> </tr> </table><br> <asp:button id="btnSubmit" Text="Submit" OnClick="btnSubmit_Click" runat=server/> <asp:button id="btnClear" Text="Clear" OnClick="btnClear_Click" runat=server/> <p><asp:Label id="lblMsg1" runat=server/></p> </form> </html>
<%-- This example shows how to send a mail message from a Web Forms page using the classes in the System.Web.Mail namespace. --%> <%@ IMPORT namespace="System.Web.Mail" %> <html> <script language=C# runat=server> void Page_Load() { if (!IsPostBack) { txtTo.Text="john@contoso.com"; txtFrom.Text="marsha@contoso.com"; txtCc.Text="fred@contoso.com"; txtBcc.Text="wilma@contoso.com"; txtSubject.Text="Hello"; txtBody.Text="This is a test message."; txtAttach.Text=@"C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Sunset.jpg," + @"C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Winter.jpg"; txtBodyEncoding.Text = Encoding.ASCII.EncodingName; txtBodyFormat.Text="HTML"; txtPriority.Text="Normal"; txtUrlContentBase.Text="http://www.contoso.com/images"; txtUrlContentLocation.Text="http://www.contoso.com/images"; // Name of relay mail server in your domain. txtMailServer.Text="smarthost"; } } void btnSubmit_Click(Object sender, EventArgs e) { string sTo, sFrom, sSubject, sBody; string sAttach, sCc, sBcc, sBodyEncoding; string sBodyFormat, sMailServer, sPriority; string sUrlContentBase, sUrlContentLocation; int iLoop1; sTo = txtTo.Text.Trim(); sFrom = txtFrom.Text.Trim(); sSubject = txtSubject.Text.Trim(); sBody = txtBody.Text.Trim(); sAttach = txtAttach.Text.Trim(); sCc = txtCc.Text.Trim(); sBcc = txtBcc.Text.Trim(); sBodyFormat = txtBodyFormat.Text.Trim(); sBodyEncoding = txtBodyEncoding.Text.Trim(); sPriority = txtPriority.Text.Trim(); sUrlContentBase = txtUrlContentBase.Text.Trim(); sUrlContentLocation = txtUrlContentLocation.Text.Trim(); sMailServer = txtMailServer.Text.Trim(); MailMessage MyMail = new MailMessage(); MyMail.From = sFrom; MyMail.To = sTo; MyMail.Subject = sSubject; MyMail.Body = sBody; MyMail.Cc = sCc; MyMail.Bcc = sBcc; MyMail.UrlContentBase = sUrlContentBase; MyMail.UrlContentLocation = sUrlContentLocation; if (txtBodyEncoding.Text == Encoding.UTF7.EncodingName) MyMail.BodyEncoding = Encoding.UTF7; else if (txtBodyEncoding.Text == Encoding.UTF8.EncodingName) MyMail.BodyEncoding = Encoding.UTF8; else MyMail.BodyEncoding = Encoding.ASCII; switch (sBodyFormat.ToUpper()) { case "HTML": MyMail.BodyFormat = MailFormat.Html; break; default: MyMail.BodyFormat = MailFormat.Text; break; } switch (sPriority.ToUpper()) { case "HIGH": MyMail.Priority = MailPriority.High; break; case "LOW": MyMail.Priority = MailPriority.Low; break; default: MyMail.Priority = MailPriority.Normal; break; } // Build an IList of mail attachments. if (sAttach != "") { char[] delim = new char[] {','}; foreach (string sSubstr in sAttach.Split(delim)) { MailAttachment MyAttachment = new MailAttachment(sSubstr); MyMail.Attachments.Add(MyAttachment); } } SmtpMail.SmtpServer = sMailServer; SmtpMail.Send(MyMail); lblMsg1.Text="C# Message sent to " + MyMail.To; } void btnClear_Click(Object sender, EventArgs e) { lblMsg1.Text=""; txtTo.Text=""; txtFrom.Text=""; txtSubject.Text=""; txtBody.Text=""; txtAttach.Text=""; txtBcc.Text=""; txtCc.Text=""; txtBodyEncoding.Text=""; txtBodyFormat.Text=""; txtPriority.Text=""; txtUrlContentBase.Text=""; txtUrlContentLocation.Text=""; txtMailServer.Text=""; btnSubmit.Text="Submit"; } </script> <p><h4>Send a new mail message:<h4></p> <Form method="Post" action="MailForm.aspx" runat=server> <table width="350" bgcolor="#FFFF99"> <tr> <td Align="Right"><b>To:</b></td> <td><Asp:Textbox id="txtTo" runat=server/></td> </tr> <tr> <h4><td Align="Right"><b>From:</b></td></h4> <td><Asp:Textbox id="txtFrom" runat=server/></td> </tr> <tr> <td Align="Right"><b>Subject:</b></td> <td><Asp:Textbox id="txtSubject" runat=server/></td> </tr> <tr> <td Align="Right"><b>MessageBody:</b></td> <td><Asp:Textbox id="txtBody" runat=server/></td> </tr> <tr> <td Align="Right"><b>Attachments:</b></td> <td><Asp:Textbox id="txtAttach" runat=server/></td> </tr> <tr> <td Align="Right"><b>CC:</b></td> <td><Asp:Textbox id="txtBcc" runat=server/></td> </tr> <tr> <td Align="Right"><b>BCC:</b></td> <td><Asp:Textbox id="txtCc" runat=server/></td> </tr> <tr> <td Align="Right"><b>BodyEncoding:</b></td> <td><Asp:Textbox id="txtBodyEncoding" runat=server/></td> </tr> <tr> <td Align="Right"><b>BodyFormat:</b></td> <td><Asp:Textbox id="txtBodyFormat" runat=server/></td> </tr> <tr> <td Align="Right"><b>Priority:</b></td> <td><Asp:Textbox id="txtPriority" runat=server/></td> </tr> <tr> <td Align="Right"><b>URL Content Base:</b></td> <td><Asp:Textbox id="txtUrlContentBase" runat=server/></td> </tr> <tr> <td Align="Right"><b>URL Content Location:</b></td> <td><Asp:Textbox id="txtUrlContentLocation" runat=server/></td> </tr> <tr> <td Align="Right"><b>Mail Server:</b></td> <td><Asp:Textbox id="txtMailServer" runat=server/></td> </tr> </table><br> <asp:button id="btnSubmit" Text="Submit" OnClick="btnSubmit_Click" runat=server/> <asp:button id="btnClear" Text="Clear" OnClick="btnClear_Click" runat=server/> <p><asp:Label id="lblMsg1" runat=server/></p> </form> </html>

System.Web.Mail.MailMessage


Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


MailMessage コンストラクタ ()
アセンブリ: System (system.dll 内)



Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


MailMessage コンストラクタ (String, String)
アセンブリ: System (system.dll 内)




public static void CreateTestMessage2(string server) { string to = "jane@contoso.com"; string from = "ben@contoso.com"; MailMessage message = new MailMessage(from, to); message.Subject = "Using the new SMTP client."; message.Body = @"Using this new feature, you can send an e-mail message from an application very easily."; SmtpClient client = new SmtpClient(server); // Credentials are necessary if the server requires the client // to authenticate before it will send e-mail on the client's behalf. client.UseDefaultCredentials = true; client.Send(message); }

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


MailMessage コンストラクタ (String, String, String, String)
アセンブリ: System (system.dll 内)

Dim from As String Dim to As String Dim subject As String Dim body As String Dim instance As New MailMessage(from, to, subject, body)


新しい MailMessage オブジェクトのプロパティは、次のように初期化されます。
既定では、件名とメッセージの内容はローカル コンピュータの設定に基づく既定のエンコーディングを使用すると見なされます。異なるエンコーディングを指定するには、BodyEncoding プロパティおよび SubjectEncoding プロパティを使用します。

public static void CreateTimeoutTestMessage(string server) { string to = "jane@contoso.com"; string from = "ben@contoso.com"; string subject = "Using the new SMTP client."; string body = @"Using this new feature, you can send an e-mail message from an application very easily."; MailMessage message = new MailMessage(from, to, subject, body); SmtpClient client = new SmtpClient(server); Console.WriteLine("Changing time out from {0} to 100.", client.Timeout); client.Timeout = 100; // Credentials are necessary if the server requires the client // to authenticate before it will send e-mail on the client's behalf. client.Credentials = CredentialCache.DefaultNetworkCredentials; client.Send(message); }

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


MailMessage コンストラクタ (MailAddress, MailAddress)
アセンブリ: System (system.dll 内)

Public Sub New ( _ from As MailAddress, _ to As MailAddress _ )
Dim from As MailAddress Dim to As MailAddress Dim instance As New MailMessage(from, to)
public MailMessage ( MailAddress from, MailAddress to )
public: MailMessage ( MailAddress^ from, MailAddress^ to )
public MailMessage ( MailAddress from, MailAddress to )
public function MailMessage ( from : MailAddress, to : MailAddress )



public static void CreateTestMessage3() { MailAddress to = new MailAddress("jane@contoso.com"); MailAddress from = new MailAddress("ben@contoso.com"); MailMessage message = new MailMessage(from, to); message.Subject = "Using the new SMTP client."; message.Body = @"Using this new feature, you can send an e-mail message from an application very easily."; // Use the application or machine configuration to get the // host, port, and credentials. SmtpClient client = new SmtpClient(); Console.WriteLine("Sending an e-mail message to {0} at {1} by using the SMTP host {2}.", to.User, to.Host, client.Host); client.Send(message); }

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


MailMessage コンストラクタ

名前 | 説明 |
---|---|
MailMessage () | MailMessage クラスの空のインスタンスを初期化します。 |
MailMessage (MailAddress, MailAddress) | MailAddress クラスのオブジェクトを指定して、MailMessage クラスの新しいインスタンスを初期化します。 |
MailMessage (String, String) | String クラスのオブジェクトを指定して、MailMessage クラスの新しいインスタンスを初期化します。 |
MailMessage (String, String, String, String) | MailMessage クラスの新しいインスタンスを初期化します。 |

MailMessage コンストラクタ
アセンブリ: System.Web (system.web.dll 内)


Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


MailMessage プロパティ

名前 | 説明 | |
---|---|---|
![]() | AlternateViews | メッセージ本文の別形式の表示内容を格納するために使用する添付データのコレクションを取得します。 |
![]() | Attachments | この電子メール メッセージに添付されるデータを格納するために使用する添付データのコレクションを取得します。 |
![]() | Bcc | この電子メール メッセージの BCC (blind carbon copy) 受信者を格納するアドレスのコレクションを取得します。 |
![]() | Body | メッセージ本文を取得または設定します。 |
![]() | BodyEncoding | メッセージ本文をエンコードするために使用されるエンコーディングを取得または設定します。 |
![]() | CC | この電子メール メッセージの CC (carbon copy) 受信者を格納するアドレスのコレクションを取得します。 |
![]() | DeliveryNotificationOptions | この電子メールの配信通知を取得または設定します。 |
![]() | From | この電子メールの差出人アドレスを取得または設定します。 |
![]() | Headers | この電子メール メッセージで送信される電子メール ヘッダーを取得します。 |
![]() | IsBodyHtml | 電子メール メッセージの本文が HTML 形式かどうかを示す値を取得または設定します。 |
![]() | Priority | この電子メールの優先順位を取得または設定します。 |
![]() | ReplyTo | 電子メール メッセージの ReplyTo アドレスを取得または設定します。 |
![]() | Sender | この電子メール メッセージの差出人のアドレスを取得または設定します。 |
![]() | Subject | この電子メールの件名を取得または設定します。 |
![]() | SubjectEncoding | この電子メール メッセージの件名の内容に使用されるエンコーディングを取得または設定します。 |
![]() | To | この電子メール メッセージの受信者を格納するアドレスのコレクションを取得します。 |

MailMessage プロパティ


MailMessage メソッド

名前 | 説明 | |
---|---|---|
![]() | Dispose | オーバーロードされます。 MailMessage によって使用されているリソースを解放します。 |
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Dispose | オーバーロードされます。 MailMessage によって使用されているリソースを解放します。 |
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

MailMessage メソッド

名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 ( Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 ( Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

MailMessage メンバ
SmtpClient クラスを使用して送信できる電子メール メッセージを表します。
MailMessage データ型で公開されるメンバを以下の表に示します。


名前 | 説明 | |
---|---|---|
![]() | AlternateViews | メッセージ本文の別形式の表示内容を格納するために使用する添付データのコレクションを取得します。 |
![]() | Attachments | この電子メール メッセージに添付されるデータを格納するために使用する添付データのコレクションを取得します。 |
![]() | Bcc | この電子メール メッセージの BCC (blind carbon copy) 受信者を格納するアドレスのコレクションを取得します。 |
![]() | Body | メッセージ本文を取得または設定します。 |
![]() | BodyEncoding | メッセージ本文をエンコードするために使用されるエンコーディングを取得または設定します。 |
![]() | CC | この電子メール メッセージの CC (carbon copy) 受信者を格納するアドレスのコレクションを取得します。 |
![]() | DeliveryNotificationOptions | この電子メールの配信通知を取得または設定します。 |
![]() | From | この電子メールの差出人アドレスを取得または設定します。 |
![]() | Headers | この電子メール メッセージで送信される電子メール ヘッダーを取得します。 |
![]() | IsBodyHtml | 電子メール メッセージの本文が HTML 形式かどうかを示す値を取得または設定します。 |
![]() | Priority | この電子メールの優先順位を取得または設定します。 |
![]() | ReplyTo | 電子メール メッセージの ReplyTo アドレスを取得または設定します。 |
![]() | Sender | この電子メール メッセージの差出人のアドレスを取得または設定します。 |
![]() | Subject | この電子メールの件名を取得または設定します。 |
![]() | SubjectEncoding | この電子メール メッセージの件名の内容に使用されるエンコーディングを取得または設定します。 |
![]() | To | この電子メール メッセージの受信者を格納するアドレスのコレクションを取得します。 |

名前 | 説明 | |
---|---|---|
![]() | Dispose | オーバーロードされます。 MailMessage によって使用されているリソースを解放します。 |
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Dispose | オーバーロードされます。 MailMessage によって使用されているリソースを解放します。 |
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

MailMessage メンバ
電子メールを作成するためのプロパティとメソッドを提供します。推奨する代替 : System.Net.Mail
MailMessage データ型で公開されるメンバを以下の表に示します。



名前 | 説明 | |
---|---|---|
![]() | Equals | オーバーロードされます。 2 つの Object インスタンスが等しいかどうかを判断します。 (Object から継承されます。) |
![]() | GetHashCode | 特定の型のハッシュ関数として機能します。GetHashCode は、ハッシュ アルゴリズムや、ハッシュ テーブルのようなデータ構造での使用に適しています。 (Object から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

- MailMessageのページへのリンク