简体   繁体   中英

Get pop3 mail in plain text

I recently wrote a small app which periodically downloads emails from a pop3 mail account and saves bits of the mail to a database. Its part of a ticket-type system I'm implementing.

It was based up on Luke Niland's 'Simple POP3 Email Class' and it worked a treat, so long as the main came through as plain text.

If the mail was RTF or HTML, the MIME (base64 encoded?) version of the whole mail was displayed, and I wasn't able to parse through it successfully.

I tried to overcome the problem by setting the mail server to only serve mail to a particular address in plaintext, but that just didnt work.

What I would like to do is figure work out a quick and easy way to decode the encoded email type, strip out the rest and leave me with just the plaintext version of the email.

Can anyone point me in the right direction?

You should be able to decode easily enough.

Dim emailBytes As Byte() = System.Convert.FromBase64String(downloadedEmail)
Dim decodedText As String = System.Text.ASCIIEncoding.ASCII.GetString(emailBytes)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM