An error occurred.
Sorry, the page you are looking for is currently unavailable.
Please try again later.
If you are the system administrator of this resource then you should check the error log for details.
Faithfully yours, nginx.
I'm not receiving emails from mail() function.
I created a php test:
<?php ini_set( 'display_errors', 1 ); error_reporting( E_ALL ); $from = "email@example.com"; $to = "firstname.lastname@example.org"; $subject = "PHP Mail Test script"; $message = "This is a test to check the PHP Mail functionality"; $headers = "From:" . $from; $headers .= "Reply-To: $to"; var_dump(mail($to,$subject,$message,$headers));
The output is...
I'm using a LEMP droplet on Ubuntu 16.06. I already installed postfix, opened port 25 and checked my host file...
127.0.0.1 localhost.crazytraction localhost amsterdam
which I think is correct (amsterdam is the hostname)
I can receive the email in one of my accounts, but I tried other 3 and none of them received the email, even Gmail is not receiving it.
What Am I doing wrong?
Btw, I tested to send an email using the same function on another droplet and it worked, so it has to be something with the environment, but I cannot figure what it is!
I spent hours tonight trying to figure out why sendmail and the php mail() function wouldn't work on my DigitalOcean server. I followed all of the tutorials and couldn't get anything to work. It turns out Gmail was blocking all of the mail coming from my DigitalOcean server. The mail I was sending couldn't even make it to the spam folder. I discovered this by running sendmail from the command line. I then tried sending mail to a non-gmail account, and it worked just fine! So if anyone else is going through hell trying to figure this out, try sending some mail to a non-gmail account, or try running sendmail from the command line to see if you get some sort of error about Google / Gmail blocking your mail to prevent spam.
AND ONE MORE THING: The DigitalOcean server that was blocked by Gmail was not associated with a domain name, it simply had an IP address. I tried using sendmail and the php mail function on another DigitalOcean server of mine that is associated with a domain name, and that email was NOT BLOCKED. So if Gmail is blocking mail from your DigitalOcean server, it may be because your server isn't associated with a domain name.