共用方式為


MailMessage.Attachments 屬性

定義

指定與訊息一起傳送的附件集合。 建議的替代做法: System.Net.Mail

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

屬性值

IList

IList 物件的 MailAttachment 集合。

範例

MailMessage MyMessage = new MailMessage();
MyMessage.Attachments.Add(new MailAttachment(fileName1));
MyMessage.Attachments.Add(new MailAttachment(fileName2, MailEncoding.UUEncode));
Dim MyMessage As MailMessage = new MailMessage()
MyMessage.Attachments.Add(New MailAttachment(fileName1))
MyMessage.Attachments.Add(New MailAttachment(fileName2, MailEncoding.UUEncode))

備註

呼叫 即可將新的附件新增至郵件訊息 Message.Attachments.Add(MyMailMessage) 。 如需使用方式範例, SmtpMail 請參閱 Send

適用於