Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automate saving received mails? 1

Status
Not open for further replies.

zaxxon

MIS
Dec 12, 2001
226
DE
Hi,

I am currently getting mails with fetchmail from a pop3 server. I also found a tool called "munpack" to extract the attached files of these mails, once they are written into the mbox for example.

What might be a good way to automate the writing of the received mails into a file? Ie. is there a way I can tell my MUA (mail? mutt? pine?) to be triggered from a shell script, read the message so that it will be written into mbox for example?
Or is there an easier or other way that is usually used to do that, maybe with procmail or... ?? :)

laters
zaxxon

laters
zaxxon
 
Geezus, I'm starting to hate this site, I'm typing this response for the third time because the servers keep going out to lunch.

You could automate the saving of attachments via some sort of "send this key, expect this reponse" with your mail client, one tool that is designed for just that sort of thing is "expect".

However I think it would be better to find a scripting language with tools that understand MIME and how to process mail requests and MIME attachments. This will give you much better flexibility and reliability. Python has both mail and mime tools.


 
Look at man mail, special attention to .mailrc. You can do special things as the mail comes in like being piped to your program.
 
Hi,

found an easy solution after searching and testing some time:

I just forward the incomming mail with a .forward file in the users $HOME and in there it is being piped to procmail which checks the mail by rules written in .procmailrc. For separating attachments and message from a mail I use "munpack", a nice tool I found on the web (sources).

laters
zaxxon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top