Very slow email delivery to users

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?

Show comments

Submit an answer

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!

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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 :(

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