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 コンストラクタ ()
アセンブリ: 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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からMailMessage コンストラクタを検索する場合は、下記のリンクをクリックしてください。

- MailMessage コンストラクタのページへのリンク