[Last Call] Learn how to a build a cloud-first strategyRegister Now


pipe email to php script postfix

Posted on 2014-08-01
Medium Priority
Last Modified: 2014-12-05
First of all please allow me to say that I am very new to linux and ubuntu and postfix.

I am trying to create a mail server that will accept all mail from a bunch of fictitious email addresses but instead of postfix delivering these to a mailbox, I want the emails to be redirected to a PHP script. From there I will handle the emails in PHP and take care of the contents. I do not want anything stored in postfix mailboxes.

So far I've been able to fire up a ubuntu box, install postfix and get postfix to not throw errors when i telnet on port 25 from my windows machine and try to send it mail using the following tutorial.

The problem I have is that the email is not being redirected to the php script and I can't figure out how to change that.

I've been following just about every tutorial there is out on the web but all of them have gaps in their instructions as they assume you are already an advanced linux or postfix user. The best one I've found so far is here but I cannot su www-data as I'm getting the following error;

This account is currently not available.

Open in new window

Also when emails get "delivered" to postfix, I am getting the following error;

Aug  1 10:49:46 BMPOSTFIX01 pipe[2082]: fatal: pipe_command: execvp /path/to/file/postfix1.php: Permission denied

Open in new window

Please help!
Question by:tdilbert
  • 2
LVL 29

Accepted Solution

fibo earned 1000 total points
ID: 40245724
www-data is the default user name in Apache for the web-server page-delivery service (I think for nginx webserver too, but did not check)

Test running ./postfix.php with any user you want... but it should finally be the user which will run the script. Access rights issues might arise at the script level (should be runnable by "user" but usually not "group" nor "others") and at the logfile level (should be writable by the user running the script, whether as "user" or "group", readabl by user and group) etc
LVL 29

Expert Comment

ID: 40442265

Where do U currently stand on this? How did U solve it?

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
Simple Linear Regression
Introduction to Processes

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question