Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

So I setup everything for postfix/imap properly by going through https://help.ubuntu.com/community/PostfixBasicSetupHowto and i'm able to send emails to fmaster@ME1.com/root@ME1.com

however, I'm trying to send an email to test@ME1.com then use /etc/aliases to pipe that email into php stdin, and my emails are getting returned by postmaster.

the only accounts I have setup on the box are root and fmaster. Do I need to create a test account if I'm only using test's alias to pipe output to php? I'm not sure where I've gone wrong.

my /etc/aliases:

# Required aliases
postmaster: root
MAILER-DAEMON:  postmaster

# Common aliases
abuse:      postmaster
spam:       postmaster

# PIPE OUTPUT TO PHP from test@ME1.com
test: "| php -q /root/scripts/readmail.php

the important stuff in my /etc/postfix/main.cg (with domains obscured)

myhostname = XYZ.members.linode.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = mail.ME1.com, localhost, ME1.com, ME1.it
relayhost = 
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
#mailbox_command = 
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
home_mailbox = Maildir/

then my /root/scripts/readmail.php is just:

$data = file_get_contents('php://stdin');
error_log($data); // just to see if it was successful

Anyone see where I'm going wrong?

share|improve this question
1  
For starters - make sure you provide the full path to php in your pipe alias '| /usr/bin/php -q ... etc' - second: are you sure you ran newaliases? –  thinice Mar 14 '12 at 17:08
    
that was it.. wasn't referencing full php path.. thanks @thinice –  tester Mar 14 '12 at 17:11
    
you could put this in the answers section so I can mark it? –  tester Mar 14 '12 at 17:11
    
Glad it helped - posted and thanks for caring :) –  thinice Mar 14 '12 at 17:21

1 Answer 1

up vote 2 down vote accepted

For starters: make sure you provide the full path to php in your pipe alias '| /usr/bin/php -q ... etc' - second: are you sure you ran newaliases?

That pipe command should work as I use something identical sans the full path part.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.