I am migrating some applications to AWS and trying to seperate some mailing functions from the application servers.
To cut a long story short I am trying to configure PHP (using PEAR Mail.php) to send mail via a remote mail server over ssh via a sh script configured in the php.ini sendmail_path.
My sendmail_path in php.ini is
/data/scripts/mailer.sh -t -i
My mailer.sh is
ssh appuser@remotehost.com "cat /dev/stdin | /usr/sbin/sendmail \"$@\" &"
I have confirmed on the remote host that the sending server is authenticating fine but no mail is being sent and no logs are showing in the mail.log. When I test it manually using:
ssh appuser@remotehost.com "echo \"Hello\" | /usr/sbin/sendmail test@example.com"
It works fine, that is the server authenticates and sends the mail via the remote sendmail.
For some reason though it doesnt work with my script and/or php.ini setting.
Cheers.