Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EC2 - Fresh PHP install - Mail not working

I am getting familiar with Amazons EC2. I installed a LAMP setup but when I try to send emails through the mail() function that I have in my pages it does not work. I checked and sendmail is running and is on the phpinfo page.

I have tried changing the php.ini sendmail_from and it does nothing. SMTP port is open on the firewall... im freakin lost..

like image 961
Quinton Pike Avatar asked Mar 13 '11 20:03

Quinton Pike


People also ask

What is PHP mail () function?

PHP mail() function is used to send email in PHP. You can send text message, html message and attachment with message using PHP mail() function.

Can I send email from EC2?

If you're using Amazon SES to send email from an Amazon EC2 instance, you should also complete the following steps: You may need to assign an Elastic IP Address to your Amazon EC2 instance in order for receiving email providers to accept your email.


1 Answers

This won't directly solve your issue (edit: I mean the error message you have now edited out), but Amazon EC2 instances have a really spotty mail reputation. You're probably going to have deliverability issues.

Thankfully Amazon created the Simple Email Service to go along with EC2, with a free level of service for EC2 customers. The API is pretty simple and there are transport adapters for many excellent PHP mailing libraries, like SwiftMailer (transport).

like image 70
Charles Avatar answered Oct 16 '22 07:10

Charles