I have followed this answer Pipe all Postfix email for a domain to PHP script - Centos7/EC2 to direct incoming mail for a specific address to a PHP script.
My aliases file entry looks like:
mail-incoming-php: "/usr/bin/php -q /var/spool/mail/php/incoming.php"
And the Postfix virtual file maps the e-mail address to
My current test PHP script is set to create an empty file, which I have tested. When sending mail to the address in question the PHP script does not create a file, and the
maillog contains this error:
cannot append message to file /usr/bin/php -q /var/spool/mail/php/incoming.php: cannot create file exclusively: No such file or directory
I have temporarily set the PHP script's permission to 777 and get the same error.
Maybe this is not the best way to solve this problem or something else needs doing?
All I need the script to do is read the contents of the incoming e-mail, the e-mail doesn't have to be relayed after this.