Very slow email delivery to users

Posted May 29, 2016 5.7k views
UbuntuApachePHPDigitalOceanConfiguration Management

I have a registration script that sends the user an email activation link upon successful user registration. From my localhost on my laptop, the email is sent instantly. However, on my Digital Ocean server running Ubuntu it takes 30 minutes to receive this email.

I have this in my code
$mail->Host = “”;

I assume this is a server issue. But what needs to be fixed or configured on my server?

  • You would need to check the mail logs at if you have access to those. It could be that your sending server is “greylisted” there for some reason. You might be sending funky HELO names or have a mismatched rdns from the smtp servers perspective.

  • Thanks for responding. I thought it could be a zoho issue as well until I tried using gmail instead.

    $mail->Host = “”;

    I had the same issue, it still took 30 minutes to send the registration confirmation emails. The weird part is that after hitting the submit button, the loader spins in Chrome and Firefox for 30 minutes. And I can’t navigate my site anymore after hitting the ‘register’ button.

    It’s like the site is stuck trying to finish the registration process. So I have to quit the browser and relaunch, then my site works as normal, until I try to do another test registration. But again, all of this works like a charm from my localhost with MAMP.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

It could be that DNS is taking a time to find your MX record. So, check your DNS servers.

same issue here as well !! The settings from this
worked fine for localhost! But in droplets it does'nt send the mail.

the error is “cannot connect to, port 587: Connection timed out”

Please someone help me :(

by Jesin A
Read through this tutorial to learn how to use Gmail or Yahoo with PHP mail() function.