1

Topic: Piping email to PHP Script

================ Required information ====
- iRedMail version (check /etc/iredmail-release): iRedMail-0.9.2
- Linux/BSD distribution name and version: Ubuntu 14.04
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Apache
- Manage mail accounts with iRedAdmin-Pro? No
- Related log if you're reporting an issue: -
====

I followed the tutorial here: http://www.iredmail.org/docs/pipe.incom … cript.html but it is not executing the php script.

I added this to /etc/postfix/master.cf and then restarted postfix

external-pipe   unix    -   n   n   -   -   pipe
    flags= user=vmail:vmail argv=/var/www/html/script.php

Then I added this to mysql

sql> USE vmail;
sql> UPDATE mailbox SET transport='external-pipe' WHERE username='thisuser@domain.com';

And this is the script.php

#!/usr/bin/php -q
<?php
mail("myemail@email.com", "Test Success", "Test is successful.", "From: Someone email@email2.com");
?>

With full execute settings

script.php File Permissions: 775

And my php location is

#>which php
#>/usr/bin/php

Changing the transport in mysql to external-pipe is sending the email somewhere because it is making it so the emails do not reach the iRedMail inbox. But the php script is not executing to email me the success mail.

What am I doing wrong?

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Piping email to PHP Script

Any related log in Postfix and Dovecot log files? (/var/log/mail.log, /var/log/dovecot*.log)