How to get a newline in HTML of htmlTextPart

18 views
Skip to first unread message

er...@vanlinsteeict.nl

unread,
Mar 9, 2016, 7:30:01 AM3/9/16
to VMime
When I use the code from the Book newlines in my text part get translated to =0A. Which is not quite what I want.

Does anyone know what to do? I have not been able to find any clues in the Book, or the source, for that matter.

For instance, the following code fragment:

mMessageBuilder.constructTextPart(vmime::mediaType
(vmime::mediaTypes::TEXT,
vmime::mediaTypes::TEXT_HTML));

auto textPart =
mMessageBuilder.getTextPart().dynamicCast <vmime::htmlTextPart>();

textPart->setCharset(vmime::charsets::UTF_8);

auto message = "<html>\n"
" <body>\n"
"<p>bla bla</p>"
" </body>\n"
"</html>";

textPart->setText(vmime::create <vmime::stringContentHandler>(message));


results in (relevant part only)

Content-Type: text/html; charset=iso-8859-15
Content-Transfer-Encoding: quoted-printable

<html>=0A <body>=0A<p>bla bla</p>=0A </bod=
y>=0A</html>


and should have been:

Content-Type: text/html; charset=iso-8859-15
Content-Transfer-Encoding: quoted-printable

<html>
<body>
<p>bla bla</p>
</body>
</html>

er...@vanlinsteeict.nl

unread,
Mar 9, 2016, 9:14:39 AM3/9/16
to VMime
Oh never mind.

textPart->setText(vmime::create <vmime::stringContentHandler>(message));

Should have been:

textPart->setText(vmime::create <vmime::stringContentHandler>(message,
vmime::encoding("quoted-printable"));

Reply all
Reply to author
Forward
0 new messages