0

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.

  • I should add, SMTP is not an option. – Michael B Jun 8 '16 at 2:03
  • I think I managed to figure this out. I changed my mailer.sh script to have: ssh ilr_app_01@ilr-mlr-01.i-linkresearch.com "cat /dev/stdin | /usr/sbin/sendmail -t -i" Seems to be working well. – Michael B Jun 9 '16 at 23:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.