I’m not receiving emails from mail() function.
I created a php test:
<?php
ini_set( 'display_errors', 1 );
error_reporting( E_ALL );
$from = "info@crazytraction.com";
$to = "pabloezequiel@gmail.com";
$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…
bool(true)
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!
Thank you.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Your SPF record is invalid and you are not sending all the required headers an e-mail should have.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.