Name

MailAttachment

Synopsis

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 System.Web.Mail.Encoding.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 Sub New(ByVal filename As String) 
   Public Sub New(ByVal filename As String, 
        ByVal encoding As MailEncoding) 
' Public Instance Properties
   Public ReadOnly Property Encoding As MailEncoding  
   Public ReadOnly Property Filename As String  
End Class

Get ASP.NET in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.