You can use the MailPutAttachment, MailGetAttachment, MailDeleteAttachment, MailRequestAttachment, and MailLocalAttachmentLen functions to work with mail attachments. With these functions you can create, open, or delete an attachment. You can also request to download one or query for its length.
You work with attachments the way you would work with a message: You register an intended operation in the dwFlags parameter of the MailAtt structure. For example, you set the parameter to ATT_DISP_RETRIEVE when you want the attachment downloaded to the local device.
The Mail Interface API uses the szLocalName member of MailAtt to determine whether the attachment is local or non-local. For a non-local attachment, you must set szLocalName to NULL before passing it to MailPutAttachment for example. For a non-local attachment, you must specify the length, ulSize, of the original file. For local attachments, the size is determined by examining the file.