Catalyst Internet Mail .NET

InternetMail.AttachData Method (Byte[], Int32, String)

Attach the contents of a byte array to the current message.

[Visual Basic]
Overloads Public Function AttachData( _
   ByVal buffer As Byte(), _
   ByVal length As Integer, _
   ByVal contentName As String _
) As Boolean
[C#]
public bool AttachData(
   byte[] buffer,
   int length,
   string contentName
);

Parameters

buffer
A byte array that contains the data to be attached to the message.
length
An integer value which specifies the maximum number of bytes top copy from the buffer. This value cannot be larger than the size of the buffer specified by the caller.
contentName
An string argument which specifies a name for the data being attached to the message. This typically is used as a file name by the mail client to store the data in. If this parameter is omitted or passed as an empty string then no name is defined and the data is attached as inline content. Note that if a file name is specified with a path, only the base file name will be used.

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 buffer will be examined to determine what kind of data it contains. If there is only text characters, then the content type will be specified as text/plain. If the buffer contains binary data, then the content type will be specified as application/octet-stream, which is appropriate for any type of data.

See Also

InternetMail Class | SocketTools Namespace | InternetMail.AttachData Overload List