How to extract the text content part of an email using the VMIME lib? I use the following code:
vmime::ref <vmime::body> body = Msg -> getBody();
vmime::ref <const vmime::contentHandler> cts = body -> getContents();
cts -> extract(out);
However, the content printed out is the whole body part of MIME structure of the email, including boundary and parameter settings.
--001a11c2e29cfe6d9f04e8b9a834
Content-Type: text/plain; charset=ISO-8859-1
test1
--001a11c2e29cfe6d9f04e8b9a834
Content-Type: text/html; charset=ISO-8859-1
<div dir="ltr"><br clear="all"><div>test1</div>
</div>
--001a11c2e29cfe6d9f04e8b9a834--
What I need is just the text content. However, I cannot find any API to extract just the text content.
What I need:
test1
I have been stuck for 3 days. Could anyone help???
You should use vmime::messageParser object to parse your message. This way, you will get the text contents via the vmime::textPart objects (use getTextPartList() method on messageParser).
Vincent