Decode message

well  how can I decode the emails  so i can get plain text?

import poplib;

import io;

import string;

import encodings;


 server = poplib.POP3_SSL("",poplib.POP3_SSL_PORT);




response = server.user('');

response1 =  server.pass_('XXXXXXXX');



# download the first message in the list

messages = server.list();



Open in new window

help appreciated
Max DestinyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David FavorLinux/LXD/WordPress/Hosting SavantCommented:
You'll do this via...

1) Retrieve the message from where it lives.

Your code above looks like it's starting to bring up a server, rather than a client.

You have to connect as a client to an existing server.

2) Then break the message apart into components, might be text or MIME.

3) Then decode each component, which will occur differently based on MIME type.

Based on your code above, this might be a new process for you.

Likely best to start with some GitHub sample code. Likely there are many snippets you'll find useful.

For a 100% solution, you'll have to build a tool like the NeoMutt email client from scratch... which will be... a substantial task...

You might provide an example of an email your trying to decode.

If you have a specific type of email, this will be far simpler than a generalized approach for decoding all possible email that can every be generated.
nociSoftware EngineerCommented:
The email module can do the heavylifting for you:

Some examples of it's use:
EirmanChief Operations ManagerCommented:
I suggest that you download and install Pegasus Email (It's free)

If the message is still on the server you can download it,
choosing whether you want to leave it on the server.

Then ....
View the RAW message by clicking on the Raw View tab
Truncated to protect my privacy
It may give you the decoded view you are looking for,
but seeing how the message is composed can be useful.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.