Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP mail() function sends the email but it takes more than 10 mins to show up

Tags:

php

sendmail

So my user signs up from the Android App on his phone and after sign up is successful I trigger a mail to be sent to the signed up email address with an Activation Passcode from my PHP script. Here is the line of code that I use which is pretty trivial.

mail($to, $subject, $message, $headers);

The mail is sent correctly every time to the correct email address but the problem is the email shows up in Gmail or Hotmail or Yahoo in more than 10 minutes. That kind of a latency for receiving an Activation Code for the App "to me" is unacceptable.

What can reduce this latency and make this if not instanteneous but a lot quicker. Any ideas.

Thank you all for your help!!

like image 658
Aakash Avatar asked Feb 26 '23 23:02

Aakash


1 Answers

I had this issue with GoDaddy shared hosting, using their SMTP server. It was because the SMTP server was a shared, open relay, and with the volume of messages passing through it - there is a delay of roughly 10 minutes as well.

Are you on shared hosting/GoDaddy? What SMTP relay are you using?

EDIT: After researching this thoroughly very recently, I have found that there is no way to deliever a high quality of SMTP service (i.e. < 10 minutes for an email) to my audience on GoDaddy shared hosting. This is incredibly frustrating. Looks like the options are to buy dedicated hosting from GoDaddy (~$300/year), or to switch providers.

like image 70
barfoon Avatar answered Apr 19 '23 22:04

barfoon