I have been having a VERY hard time with this, have searched everywhere, and in utter desperation am posting this question.
I am using postfix and dovecot on ubuntu 12.04. I am trying very hard to trigger a php script which runs any time a new email is received by the server. In my /etc/postfix/main.cf I have added the line:
always_bcc = new_incoming_email@localhost
In /etc/aliases I have the line:
new_incoming_email: "|/usr/bin/php -f /path/to/file/new_incoming_email.php"
In /etc/postfix/vmaps I have the line:
new_incoming_email@localhost localhost/new_incoming_email/
When I run the file from the command-line I can see that the file works, as it adds a line to a log file as part of its function. From the command-line I type: /usr/bin/php -f /path/to/file/new_incoming_email.php
Here's what I get in /var/log/mail.log when I send an email to the server:
Feb 1 04:20:52 myserver postfix/smtpd[3090]: connect from nm40-vm4.bullet.mail.bf1.yahoo.com[72.30.239.212] Feb 1 04:20:52 myserver postfix/smtpd[3090]: C1EDD20630: client=nm40-vm4.bullet.mail.bf1.yahoo.com[72.30.239.212] Feb 1 04:20:52 myserver postfix/cleanup[3004]: C1EDD20630: message-id=<[email protected]> Feb 1 04:20:52 myserver postfix/qmgr[1092]: C1EDD20630: from=<[email protected]>, size=24383, nrcpt=2 (queue active) Feb 1 04:20:52 myserver postfix/error[3008]: C1EDD20630: to=<[email protected]>, relay=none, delay=0.22, delays=0.18/0/0/0.04, dsn=4.4.1, status=defferred (delivery temporarilyferred (delivery temporarily suspended: connect to localhost.com[74.125.224.72]:25: Connection timed out) suspended: connect to localhost.com[74.125.224.72]:25: Connection timed out) Feb 1 04:20:52 myserver postfix/virtual[3092]: C1EDD20630: to=<[email protected]>, relay=virtual, delay=0.22, delays=0.18/0.01/0/0.03, dsn=2.0.0, status=sent (delivered to maildir) Feb 1 04:20:53 myserver postfix/smtpd[3090]: disconnect from nm40-vm4.bullet.mail.bf1.yahoo.com[72.30.239.212]
With example.com is domain that exist in my server.
Here is the output of "postconf -n:"
alias_database = hash:/etc/aliases alias_maps = hash:/etc/aliases always_bcc = new_incoming_email@localhost biff = no config_directory = /etc/postfix default_privs = johnvision default_transport = smtp home_mailbox = Maildir/ inet_interfaces = all inet_protocols = all mailbox_size_limit = 0 mydestination = localhost mynetworks = 127.0.0.0/8 [::1]/128 108.171.187.9 myorigin = $myhostname recipient_delimiter = + smtp_host_lookup = native smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu/GNU) virtual_gid_maps = static:5000 virtual_mailbox_base = /home/vmail virtual_mailbox_domains = /etc/postfix/vhosts virtual_mailbox_maps = hash:/etc/postfix/vmaps virtual_minimum_uid = 1000 virtual_uid_maps = static:5000
I have been trying to get this working for quite some time. Actually, I DID have it working a while back, but I have changed something on the server (not exactly sure what) and since then it has not been working.
I really need some help with this.
postconf -n
. Looks like something wrong with your configurationnew_incoming_email@localhost
entry in ` /etc/postfix/vmaps` is useless because the localhost was defined inmydestination
not invirtual_mailbox_domains
.