[Kde-pim] Using kmime lib to create UTF-8 email message

Thomas McGuire mcguire at kde.org
Tue Jan 19 00:04:03 GMT 2010


Hi David,

On Tuesday 19 January 2010 00:32:35 David Jarvie wrote:
> I'm trying to use the kmime library to compile an email message in KAlarm,
> but can't get it to work with non-Latin scripts. I've looked at both
> mailody and the new kmail for inspiration, and can't see where I'm going
> wrong. For a plain text message with no attachments, I've tried
> 
>    KMime::Message message;
>    // Set headers ....
>    message.contentType()->setMimeType("text/plain");
>    // the message doesn't work with or without the following line:
>    message.contentType()->setCharset("utf-8");
>    message.setBody(bodyText.toUtf8());
>    message.assemble();
> 
> I also tried, instead of setBody():
> 
>    message.fromUnicodeString(bodyText);
> 
> I retrieved the final QByteArray to send using
> 
>    message.encodedContent();

Hmm, setting the content type to text/plain and then calling 
fromUnicodeString() with the QString as argument, followed by an assemble(), 
should be enough.

If that doesn't work, can you attach the encodedContent() here so I can have a 
closer look?

Regards,
Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-pim/attachments/20100119/9d928e63/attachment.sig>
-------------- next part --------------
_______________________________________________
KDE PIM mailing list kde-pim at kde.org
https://mail.kde.org/mailman/listinfo/kde-pim
KDE PIM home page at http://pim.kde.org/


More information about the kde-pim mailing list