DekGenius.com
[ Team LiB ] Previous Section Next Section

MailAttachment

System.Web.Mail (system.web.dll)class

This class encapsulates an attachment to an email message. The constructor takes a string argument that identifies the local path to the file, as in MailAttachment(@"c:\temp\report.pdf"). An optional second argument lets you set the encoding (which will be UUEncode if omitted). Once you create an instance of MailAttachment, you can add it to an instance of the MailMessage class with the MailMessage.Attachments collection. The easiest way to do this is through the Add( ) method of the MailMessage.Attachments class, like this: objMessage.Attachments.Add(objAttachment).

public class MailAttachment {
// Public Constructors
   public MailAttachment(string filename);
   public MailAttachment(string filename, MailEncoding encoding);
// Public Instance Properties
   public MailEncoding Encoding{get; }
   public string Filename{get; }
}
    [ Team LiB ] Previous Section Next Section