[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how execute command on every mail received



On Tue, Jun 15, 2010 at 05:33:47PM +0800, paragasu wrote:
> Hi all,
> 
> I wonder if there is a simple SMTP deamon.
> This deamon will execute a specific command on every email received.
> 
> I have a PHP program that will parse the email and
> send SMS to specific mobile phone number thereafter.

Assuming you have postfix: See aliases(7).

Generally you can have the following line in /etc/postfix/aliases:

sms: |/path/to/command


Alternatively, in $HOME/.forward (of user 'sms?' put:

|/path/to/command


However you may want to only send some of those mails. In such a case,
you can use something like procmail to e.g. pipe only mails with a
specific subject (or some other specific header).


Note: I assumed you use postfix. Other decent MTAs have similar
concepts and capabilities.

-- 
Tzafrir Cohen         | tzafrir@jabber.org | VIM is
http://tzafrir.org.il |                    | a Mutt's
tzafrir@cohens.org.il |                    |  best
tzafrir@debian.org    |                    | friend


Reply to: