Description
Getting the bodystructure in vmime will allow you to parse the structure but does not appear to allow you to get information about the message part type such as if it is an attachment or embedded or the file name without fetching more data from the server, even though that information was present in the structure call response.
Example.
Example6.cpp printStructure(msgIn->getStructure());
Structure:
- multipart/mixed [0 byte(s)]
- multipart/related [0 byte(s)]
1. multipart/alternative [0 byte(s)]- text/plain [955 byte(s)]
- text/html [3596 byte(s)]
2. image/png [29238 byte(s)]
- application/octet-stream [212686 byte(s)]
- application/octet-stream [17638 byte(s)]
- application/octet-stream [1732870 byte(s)]
- application/octet-stream [239432 byte(s)]
- application/octet-stream [286930 byte(s)]
- application/octet-stream [286930 byte(s)]
Actual data received from server:-
(((("text" "plain" ("charset" "us-ascii") NIL NIL "quoted-printable" 698 12)("text" "html" ("charset" "us-ascii") NIL NIL "quoted-printable" 2647 68) "alternative" ("boundary" "000_LO3P123MB3148BA7952D510D2D614113897F50LO3P123MB3148GBRP"))("image" "jpeg" ("name" "image003.jpg") "image003.jpg@01D6C71D.C55F6270" "image003.jpg" "base64" 8642 NIL ("inline" ("filename" "image003.jpg" "size" "6315" "creation-date" "Mon, 30 Nov 2020 13:36:15 GMT" "modification-date" "Mon, 30 Nov 2020 13:36:15 GMT"))) "related" ("boundary" "005_LO3P123MB3148BA7952D510D2D614113897F50LO3P123MB3148GBRP" "type" "multipart/alternative"))("text" "x-vcard" ("name" "Aaron Leventhal.vcf") NIL "Aaron Leventhal.vcf" "base64" 1556 20 NIL ("attachment" ("filename" "Aaron Leventhal.vcf" "size" "1135" "creation-date" "Mon, 30 Nov 2020 13:36:00 GMT" "modification-date" "Mon, 30 Nov 2020 13:36:00 GMT"))) "mixed" ("boundary" "006_LO3P123MB3148BA7952D510D2D614113897F50LO3P123MB3148GBRP") NIL "en-us"))
If I try and get the actual attachment data using the attachmentHelper
std::vector <vmime::shared_ptr > attchs =
vmime::attachmentHelper::findAttachmentsInMessage(m->getParsedMessage());
vmime will go and fetch extra data from the server. What I would really like is to get an attachment count from the bodystructure call as it appears it has responded with attachments and filename. I would like to be able to display am attachment icon on my client without having to fetch more data such as FETCH 6 BODY.PEEK[HEADER] , FETCH 6 BODY.PEEK[1.MIME] which it is doing when I call the attachment helper.