Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: method to get attachment names / count without fetching more data #259

Open
toxicated101 opened this issue Mar 29, 2021 · 0 comments

Comments

@toxicated101
Copy link

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:

  1. multipart/mixed [0 byte(s)]
  2. multipart/related [0 byte(s)]
    1. multipart/alternative [0 byte(s)]
    1. text/plain [955 byte(s)]
    2. text/html [3596 byte(s)]
      2. image/png [29238 byte(s)]
  3. application/octet-stream [212686 byte(s)]
  4. application/octet-stream [17638 byte(s)]
  5. application/octet-stream [1732870 byte(s)]
  6. application/octet-stream [239432 byte(s)]
  7. application/octet-stream [286930 byte(s)]
  8. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant