MimeAttachFile Function  
 
BOOL WINAPI MimeAttachFile(
  HMESSAGE hMessage,  
  LPCTSTR lpszFileName,  
  DWORD dwOptions  
);

The MimeAttachFile function attaches the specified file to the message.

Parameters

hMessage
Handle to the message.
lpszFileName
Pointer to a null-terminated string which specifies the name of the file to be attached to the message.
dwOptions
A value which specifies one or more options. This parameter is constructed by using a bitwise operator with any of the following values:
Constant Description
MIME_ATTACH_DEFAULT The file attachment encoding is based on the file content type. Text files are not encoded, and binary files are encoded using the standard base64 encoding algorithm. This is the default option for file attachments.
MIME_ATTACH_BASE64 The file attachment is always encoded using the standard base64 algorithm, even if the attached file is a plain text file.
MIME_ATTACH_UUCODE The file attachment is always encoded using the uuencode algorithm, even if the attached file is a plain text file.

Return Value

If the function succeeds, the return value is non-zero. If the function fails, the return value is zero. To get extended error information, call MimeGetLastError.

Remarks

If the specified message is not a multipart message, it is marked as multipart and the attached file is appended to the message. If the message is already a multipart message, an additional part is created and the attachment is added to the message.

To attach data that is stored in a memory buffer rather than a file, use the MimeAttachData function.

Requirements

Client: Requires Windows 7, Windows Vista or Windows XP.
Server: Requires Windows Server 2008 or Windows Server 2003.
Header: Include cstools7.h.
Library: Use csmsgav7.lib.
Unicode: Implemented as Unicode and ANSI versions.

See Also

MimeAttachData, MimeExportMessage, MimeExtractFile, MimeGetAttachedFileName, MimeGetFileContentType, MimeImportMessage, MimeSetFileContentType