Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Piping all mail for a single domain to a PHP script (aliases file)

11 views
Skip to first unread message

Simon

unread,
Nov 16, 2009, 9:06:58 AM11/16/09
to
Hi

Complete newbie.

Could you please tell me what to put in my aliases file, so that all
incoming mail for *anything*@domain.com is sent to a PHP script on my
box.

I have a number of domains hosted on my box, but usually my mail is
hosted elsewhere. On this occasion, I need emails to be piped
directly to a PHP script.

Cheers

Simon

Andrzej Adam Filip

unread,
Nov 16, 2009, 12:10:57 PM11/16/09
to

I would suggest you two stage configuration:
a) deliver *@domain.com to local account
You may use FEATURE(`virtusertable') with the following entry in
virtusertable file:

@domain.com user-n

b1) use ~user-n/.forward file to execute php script

"|exec /usr/bin/php -f _php-script_"

[remember about smrsh http://www.sendmail.org/faq/section3#3.11 ]

b2) if you use Linux then most likely your sendmail uses procmail as its
local mailer procmail => IMHO it would be better to execute php
script from procmail script


HOW TO TEST IT:
As root execute:
sendmail -d60.5 -d27.2 -bv j...@domain.com
It should show virtusertable lookups and ~/.forward processing

P.S.
You have forgotten to mention if you want to pass envelope sender and
envelope recipient(s) to the script => I have chosen simpler variant
without passing :-)

--
[pl>en Andrew] Andrzej Adam Filip : an...@onet.eu : Andrze...@gmail.com
Open-Sendmail: http://open-sendmail.sourceforge.net/
I owe the public nothing.
-- J. P. Morgan

Simon

unread,
Nov 16, 2009, 12:47:19 PM11/16/09
to
Thank you for your reply.

Grant Taylor

unread,
Nov 19, 2009, 10:03:22 PM11/19/09
to
On 11/16/2009 8:06 AM, Simon wrote:
> Could you please tell me what to put in my aliases file, so that all
> incoming mail for *anything*@domain.com is sent to a PHP script on my
> box.

You could also define a new mailer (that pipes directly in to STDIN of
your PHP script) that is used via MailerTable.

I have done this for a few different things and it works out well. It
also does not require the use of VirtUserTable or Procmail or .forward
files.

Grant. . . .

0 new messages