Reputation: 1751
I'm trying to get Bitnami Magento
to send email on an AWS EC2 Ubuntu
instance. Before dealing with the Magento
configuration I am just trying to get php
to send mail.
This works
echo "My test email being sent from sendmail" | /usr/sbin/sendmail [email protected]
This doesn't
<?php
$to = '[email protected]';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: [email protected]' . "\r\n" .
'Reply-To: [email protected]' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($to, $subject, $message, $headers);
?>
It doesn't work from the browser or if I run it from SSH, like this
$php my_php_email_test.php
It gives this error
sh: 1: /usr/bin/sendmail: not found
Upvotes: 1
Views: 3555
Reputation: 46
In the first case, you specify the path to sandmail directly:
/usr/sbin/sendmail
When you run PHP code, the path to sandmail comes from php.ini. Try to change sendmail_path in php.ini from /usr/bin/sendmail to /usr/sbin/sendmail.
Upvotes: 1