MailMessage.Headersとは? わかりやすく解説

MailMessage.Headers プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

この電子メール メッセージ送信される電子メール ヘッダー取得します

名前空間: System.Net.Mail
アセンブリ: System (system.dll 内)
構文構文

Dim instance As MailMessage
Dim value As NameValueCollection

value = instance.Headers
public NameValueCollection Headers { get; }
public:
property NameValueCollection^ Headers {
    NameValueCollection^ get ();
}
/** @property */
public NameValueCollection get_Headers ()
public function get Headers
 () : NameValueCollection

プロパティ
電子メール ヘッダー格納している NameValueCollection。

使用例使用例

メール メッセージヘッダー表示するコード例次に示します

public static void CreateMessageWithAttachment4(string
 server, string to)
{
    // Specify the file to be attached and sent.
    // This example uses a file on a UNC share.
    string file = @"\\share3\c$\reports\data.xls";
    // Create a message and set up the recipients.
    MailMessage message = new MailMessage(
       "ReportMailer@contoso.com",
       to,
       "Quarterly data report",
       "See the attached spreadsheet.");

    // Create  the file attachment for this e-mail message.
    Attachment data = new Attachment("qtr3.xls", 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);
    disposition.DispositionType = DispositionTypeNames.Attachment;
    // 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 = (ICredentialsByHost)CredentialCache.DefaultNetworkCredentials;
    client.Send(message);
    // Display the message headers.
    string[] keys = message.Headers.AllKeys;
    Console.WriteLine("Headers");
    foreach (string s in
 keys)
    {
        Console.WriteLine("{0}:", s);
        Console.WriteLine("    {0}", message.Headers[s]);
    }
    data.Dispose();
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
MailMessage クラス
MailMessage メンバ
System.Net.Mail 名前空間

MailMessage.Headers プロパティ




英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

MailMessage.Headersのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



MailMessage.Headersのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS