[Gambas-user] pop3client attachment

Benoît Minisini gambas at ...1...
Sat Sep 28 00:17:13 CEST 2013


Le 27/09/2013 14:45, bill-lancaster a écrit :
> Some advice on how to extract attachment s woule be appreciated.
>
> I have a message (stored at hResultGlobal!MsgWhole) known to contain an
> attached .pdf
>
>       hMimeMessage = New MimeMessage(hResultGlobal!MsgWhole)
>       hMimeMessage.Headers["Content-Type"] produces - multipart/mixed;
> boundary="----MIME delimiter for sendEmail-530503.088449226".
> but
>       hMimeMessage.Headers["Content-Disposition"] gives a blank string
> but I know the message contains the line - 'Content-Disposition: attachment;
> filename="bg01.pdf'
>

You have to use the ContentType property. Please read the RFC about Mime 
format to understand that what is stored in the headers are not 
necessarily what *you* want to get.

As for the attachments, you must browse the Mime subparts and use the 
Data property once you have found your attachment. Again, read the RFCs 
to see that a Mime Message can have any structure : an attachment can be 
a part inside a part inside a part...

Regards,

-- 
Benoît Minisini




More information about the User mailing list