Reputation: 161
I have an Amazon EC2 instance running with RH/Linux. My problem is php mail() function which is not working although I can send mail with sendmail from command line.
I run this command. # telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
XXXXX
My php.ini setting is
mail function]
SMTP = localhost
smtp_port = 25
sendmail_path = /usr/sbin/sendmail -t -i
mail.add_x_header = On
I can't fingure out whats wrong. I am not getting any php mail error. I don't get any email as well. What could the problem be?
Upvotes: 1
Views: 5823
Reputation: 51411
Sending mail on EC2 is notoriously difficult. Most of the EC2 IP addresses are in spamming blacklists. This, combined with PHP mail()
's terrible error reporting results in a pretty horrible experience.
You'll want to use Amazon Simple Email Service in combination with EC2. They recently added an SMTP service, meaning you can use any standards-compliant PHP mailing library to send mails.
I personally recommend Swiftmailer for this task.
Upvotes: 4