MailMessage.Fields 屬性

定義

取得物件的集合 (這些物件會對應至 Microsoft Collaboration Data Objects (CDO) 欄位)。 建議的替代做法: System.Net.Mail

public:
 property System::Collections::IDictionary ^ Fields { System::Collections::IDictionary ^ get(); };
public System.Collections.IDictionary Fields { get; }
member this.Fields : System.Collections.IDictionary
Public ReadOnly Property Fields As IDictionary

屬性值

物件的 IDictionary 集合 (這些物件會對應至 Collaboration Data Objects (CDO) 欄位)。

範例

下列程式碼範例示範如何使用 Fields 屬性,將使用者名稱和密碼傳送至簡單郵件傳輸通訊協定, (SMTP) 伺服器進行驗證。

// Use the Fields property to add authentication, your username, and your password.
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");    
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "marsha"); 
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "secret");
' Use the Fields property to add authentication, your username, and your password.
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1")
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "marsha")
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "secret")

備註

屬性 Fields 可用來設定共同作業資料物件 (CDO) 的擴充屬性。 如需 CDO 的詳細資訊,請參閱 共同作業資料物件組態 CoClass

適用於