MailMessage.Attachments Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Specifies the collection of attachments that are transmitted with the message. Recommended alternative: 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
Property Value
An IList collection of MailAttachment objects.
Examples
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))
Remarks
New attachments can be added to the mail message by a call to Message.Attachments.Add(MyMailMessage)
. See Send for an example of SmtpMail usage.
Applies to
Bekerjasama dengan kami di GitHub
Sumber untuk kandungan ini boleh didapati di GitHub, di mana anda juga boleh mencipta dan menyemak isu dan menarik permintaan. Untuk maklumat lanjut, lihat panduan penyumbang kami.