I'm using a Linux machine (Debian) and installed fetchmail and procmail on it. Right now, it is able to fetch mails sent to my gmail address every one minute. However, the file fetched by fetchmail is not a regular html file, but contains quoted-printable characters.
My goal is to be able to get the HTML source code of the email, just like I would be able to do if I open Outlook on Windows, right-click on the mail and choose "Show source code".
It is also important to be able to do it programmatically, since I want to automate the task.
Edit: My initial question lacks precision, so here is more information about my problem. One of my client sends me an email everyday, that contains a table with previous business day selling data. Right now, everyday, I have to copy paste the data from the email into an EXCEL file. However, since this is a very repetitive task, I want to have a solution that can that do that for me automatically. I know how to write data to an EXCEL file with Python, and I have some idea how to retrieve information from an html document with some Python libraries.
So I decided to use crontab with Linux, fetchmail and procmail to do the following: every one minute, I check on my mail box if I have received an email from my client. If so, I run a python script on that file to retrieve the information. After that, I input that information to an EXCEL file and send it to myself.
The script works fine on my PC with the HTML source code of the email I got from Outlook. However, on my Linux machine, it doesn't work. I opened the source code of the email file from my Linux machine and found out that part of the HTML code was modified.
fetchmail
should be in multipart MIME mail format (that it contains "quoted-printable characters" is not the point). Many email clients send email in both text and HTML, as different MIME parts, but there's no guarantee that mail addressed to you does contain HTML at all (unless e.g. gmail adds it if it is missing). You can usemetamail
to extract the various parts, including the HTML.