MailMessage.Fields 属性

定义

获取一个映射到 Microsoft 协作数据对象 (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

映射到协作数据对象 (CDO) 字段的对象的 IDictionary 集合。

示例

下面的代码示例演示如何使用 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

适用于