Receive email

Hello,

i am playing with the example SMTPSocketExample (receive mail).
When viewing the mail, the subject is scrambled and the html body is displayed as html tags, raw.
Is it possible to view the mail as “rendered” Mail? And why is the subject scrambled?

Thanks Marco

Example

You could download MBS Plugins and check the example folder for the /CURL/Receive Email/CURLS email client project.

It does load email, parses them and shows them in a HTMLViewer control.

[quote=473502:@Marco Weinrich]Hello,

i am playing with the example SMTPSocketExample (receive mail).
When viewing the mail, the subject is scrambled and the html body is displayed as html tags, raw.
Is it possible to view the mail as “rendered” Mail? And why is the subject scrambled?
Example[/quote]

You need to put the HTML into an HTMLviewer in your app.

The subject line is probably encoded (as an encoded word). See here:

https://en.wikipedia.org/wiki/MIME

and look at the section on encoded-words. You’ll need to see which encoding it is (base64 or quoted-printable) and decode the encoded portion appropriately. Note that there is nothing stopping the sender having some plain text in there as well, and more than one encoded-word sequence.

Thank you!

so, to view it in a htmlviewer i have to store it temporarily as e.g. “mail.html” and then load it into the htmlviewer with loadURL?
Or is there another way?

Thanks

There is an HTMLviewer method for feeding a string to it.

But beware that you can’t feed it a text body and expect to see that displayed properly.

If you want to parse simple emails then the MBS plugin is fine. If you have more complex emails then my solution is available at https://www.mothsoftware.com/content/xojo/xojo.php . It parses anything and unscrambles the usual mistakes.