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

Empty Email Contents #62

Closed
JonathanBouligny opened this issue Jan 30, 2021 · 2 comments
Closed

Empty Email Contents #62

JonathanBouligny opened this issue Jan 30, 2021 · 2 comments

Comments

@JonathanBouligny
Copy link

JonathanBouligny commented Jan 30, 2021

msg.line_policy(mailio::codec::line_len_policy_t::VERYLARGE, mailio::codec::line_len_policy_t::VERYLARGE);
conn.fetch(2, msg);

std::cout << msg.subject() << std::endl;
std::cout << msg.content() << std::endl;

The email that i fetch gives me the subject line and its the correct subject line, however the contents are empty. The email has plenty of contents in it, images and text. I previously got the contents of another email to output, the email with the contents output had no attachment. The email without the contents output has an attachment.
How can i get the correct contents of the message?

@karastojko
Copy link
Owner

karastojko commented Jan 30, 2021

Hi, I believe you are dealing with the multipart message, thus you should fetch the parts and then print their content. Use the mime::parts() to get a MIME part. (MIME is recursively defined, so you may have nested MIME parts.) An attachment is also a MIME part, so it can be fetched in the same way. However, since it's a kind of "special" part, there is also message::attachment() to get only MIME parts which are attachments.

@JonathanBouligny
Copy link
Author

Yes that worked thank you.

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

2 participants