Printable Version of Topic

Click here to view this topic in its original format

Linuxhelp _ Technical Support _ Script run at receiving EMail?

Posted by: Treczoks Nov 5 2012, 04:09 AM

Hi, all!

I've set up my new server at home, and I thought of a feature that should be easy to implement with a simple bash or perl script. BUT: I have not yet found where to hook that script into the system.

What I want to do is to run a script every time a mail is received on a certain account. I would check the emails source (it would only act on locally (as in local network) sent mail), scan the mails body for an URL and act on it.

The final application is that I can use the "Send link" feature of the browser to send a youtube URL to the media server account, which should extract the URL, download the video with youtube-dl, put the file on the media server, and send a confirmation mail back to me stating that it is done (or reporting errors).

Digging the net I found myriad of things about sending mails from scripts, but so far nothing that would allow to send mail TO a script. I am fully aware of the security implications of running a script on receiving a mail loacally, and I'm confident that I can handle this (there is no mail-in from outside the net on the server).

Pointers, anybody?

Yours, Christian

Posted by: mogwin Nov 21 2012, 01:49 PM

There are existing solutions out there that may meet your needs. I suggest searching for procmail or mailagent.

Powered by Invision Power Board (
© Invision Power Services (