Run a script on new email

2

What's the best option to trigger a script every time I receive a new email? I'm using pine on linux. I want to feed the email to my script and do some processing. I don't have root rights on the server.

zzz

Posted 2012-06-05T20:52:49.760

Reputation: 279

How is pine getting your email? Local email? IMAP? Pop? – Doug Harris – 2012-06-05T21:05:24.217

@Doug Harris: I'm not shure how to check. In configuration menu, there's nothing that indicates imap/pop, so I guess it's local. – zzz – 2012-06-05T21:09:53.320

Answers

1

If it's local (as Doug asked) you can try a .forward file.

Most Mail Delivery Agents look for $HOME/.forward files. If $HOME/.forward simply contains an email address, it will forward your mail to that email address. There is also a file format for .forward that will send your mail to a script. You need to figure out not only whether you are using local or remote (IMAP, POP3) delivery, but what kind of local delivery program (qmail, sendmail) your system is using.

Oddly, a quick google search didn't find any comprehensive tutorials for .forward files. The best I could find for it is this kind of complicated tutorial which has a lot of details about procmail which you probably can ignore.

Rich Homolka

Posted 2012-06-05T20:52:49.760

Reputation: 27 121