1

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?

tester
  • 565
  • 8
  • 18

1 Answers1

2

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.

thinice
  • 4,716
  • 21
  • 38