SocketTools .NET Edition

MailMessage.AttachFile Method (String, MimeAttachment)

Attach the specified file to the current message.

[Visual Basic]
Overloads Public Function AttachFile( _
   ByVal fileName As String, _
   ByVal options As MimeAttachment _
) As Boolean
[C#]
public bool AttachFile(
   string fileName,
   MimeAttachment options
);

Parameters

fileName
A string which specifies the name of the file to be attached to the message.
options
A MimeAttachment enumeration which specifies how the data should be attached to the message.

Return Value

This method returns a Boolean value. If the method succeeds, the return value is true. If the method fails, the return value is false. To get extended error information, check the value of the LastError property.

Remarks

The AttachFile method attaches the specified file to the current message. If the message already contains one or more file attachments, then it is added to the end of the message. If the message does not contain any attached files, then it is converted to a multipart message and the file is appended to the message.

See Also

MailMessage Class | SocketTools Namespace | MailMessage.AttachFile Overload List