Everyday I have a report emailed to me as an attached pdf. I want to automate the download of this attachment.
Just for additional information -- I run a BASH script against the pdf (attachment) and the results from this script I need to email to another person. So to fully automate this I'll need an application which can access my email, download a specific attachment, and then email the results of a script I run to another person.
So far I have looked into fetchmail. This seems to allow me access to my email. However, it downloads my entire inbox. It would be nice if the program could be programmed to search for a specific email subject line. Also, I don't think fetchmail allows me to send mail.
Please help me find a Linux application that can access my email and download a specific attachment.
Cron Job runs calling email utility which downloads my inbox <--- Need a ulitlity recommendation plz
Awk Script runs against downloaded emails to match "subject" to regex
If subject doesn't match regex then delete email, else (if it matches) then call email utliity which can download attachment and save it into a new directory <--- need email utliity which can download attachments
This may be an approach. Use fetchmail to access emails (need to consider imap vs pop3). Run regex against subject line. If regex matches use a mime comparable application to download the PDF attachment. Run script -> create new file and move it to outbox dir. Use some kind of mxa to send the processed file to email address.
That's a good start, I'm sorry I didn't get back to you, Been working all day. I did see something like a web crawler using Perl/python but I cant think of it right now, it's late here but i will add to this tomorrow
Currently able to reach out to Gmail download a pdf from a specific sender. Next step - incorporate it with already working bash script which process the PDF. Final step is to use some other application to email the processed report.
I used mail to send through gmail. I believe you can specify a file to attach but I use it like the below. I use it to email me my android build results. I don't want the whole log, just the last little bit.
I'll have to check out mail. That'll be the next step; first I have to fetch my mail from my job's server. Testing on Gmail went ok, well see how this goes.
I haven't deployed the pi yet. Last week wasn't a good week to do it. However, hopefully mid-week I'll get the static IP and then set up fetchmail to the company's mail server.
On the homefront, I've used a few new technologies like mutt and base64 to figure a work around on CentOS7 systems.
I'm optimistic about the pi; it's running raspbian and has munpack which should make this real easy once I get the pi talking to the mail server.