The MailPutAttachment function adds or change an attachment to a mail message.
BOOL MailPutAttachment (HANDLE hMail, MailMsg * pmm, MailAtt * pma);
Header file: | Msgstore.h |
Platforms: | H/PC |
Versions: | 2.0 and later |
The function returns TRUE if the attachment is added or changed; FALSE otherwise. In the latter case, the caller is responsible for the disposition of the file. To get extended error information, use MailError or MailErrorMsg.
For a local attachment, that is, when szLocalName (a member of the MailAtt structure) is set to a non-NULL value, the MailPutAttachment function stores a local copy of the original file in a special folder which is constructed from the registry entries for the attachment directory.
There can be up to 64 attachments to a message. When a single file is attached more than once, the MailPutAttachment function ensures that every local file has a unique path (szLocalName).
Since a local file gets moved, the local name (szLocalName) supplied to the MailPutAttachment function will be different from its counterpart retrieved from the MailGetAttachment function.
When a user composes a message with a file attached, she may want to make a copy of the attached file. In this case, the application should make a copy of the original before invoking the MailPutAttachment function. It is unwise to assume that the transport service will perform such an operation.