4

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!!

Aakash
  • 3,101
  • 8
  • 47
  • 78
  • 1
    Check the message's Received: headers to be sure, but it sounds like your hosting provider has a very slow mail server. – Wooble Oct 28 '10 at 15:39
  • 1
    Are you on GoDaddy? Because I've had the same problem on GoDaddy. – William Linton Oct 28 '10 at 15:42
  • Yes I am on Godaddy. How did you resolve the issue? – Aakash Oct 28 '10 at 15:48
  • 2
    Get an provider with a faster mail queue, or run your own mail server on a dedicated box. Virtual dedicated server are cheap today, and essential for running stable, secure webapps, but obviously you will need to learn to administer the server. – bobince Oct 28 '10 at 16:05
  • THANKS for all your help guys! I think dedicated server is the way to go then... – Aakash Oct 28 '10 at 16:39

5 Answers5

5

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.

barfoon
  • 27,481
  • 26
  • 92
  • 138
  • I am on GoDaddy but how do I find out if it is Shared Hosting? Also where do I find the SMTP relay info? Except for the mail() function I am not using anything in the PHP script. – Aakash Oct 28 '10 at 15:45
  • This is the response I got from GoDaddy: – barfoon Oct 28 '10 at 16:14
  • 1
    "At this time the only SMTP server available for use on our Hosting accounts is relay-hosting.secureserver.net. You would not be able to use GMail's outgoing server with our Shared Hosting accounts.  Additionally, as this is a shared SMTP server, it is not unusual to experience a slight delay in the sending of emails.  If these emails are being received within 60 minutes of their send time, this is within the acceptable time frames for a shared server.  If you experience delays longer than 60 minutes or errors associated with SMTP relaying, please reply back. " – barfoon Oct 28 '10 at 16:15
  • That makes sense. Now I understand what the delay is all about. Thanks for the clarification. – Aakash Oct 28 '10 at 16:37
  • IMHO by using GoDaddy you get what you deserve: cheap service for millions of users == poor useless support and irritating issues like the one explained in this Q/A. For similar prices you can find smaller hosting companies that are more dedicated to support their customers as http://www.qualityhostonline.com and more willing to adjust to their customers needs. – Marco Demaio Jun 22 '11 at 10:38
3

On top of everything else, the receiving end may be using greylisting, which basically bounces an email on the first delivery attempt, on the theory that spam sources won't bother retrying, while a legitimate server WILL re-try after a few minutes.

Marc B
  • 356,200
  • 43
  • 426
  • 500
0

most likely it is your server, perhaps you have a anti-spam program or anti-virus program? If you are on a shared environment there may be a que.

Darren
  • 10,631
  • 8
  • 42
  • 64
0

I'll guess you're using some shared hosting which probably is using some q system and therefor the delay... If your really picky about getting your mail delivered at once i would recommend dedicated hosting

Breezer
  • 10,410
  • 6
  • 29
  • 50
  • you could use curl to login to your email account and email your emails but that would require quite some coding from your side... if you decide to change provider may i recommend one.com quite cheap and fast used them for 3 years and they've never let me down – Breezer Oct 28 '10 at 16:27
  • I want to try curl before going for a dedicated server. – Aakash Oct 28 '10 at 17:17
0

Try this service guys...awesome API integration. www.postmarkapp.com After lot of searching I integrated my Android App Account Activation email service to Postmark and works like a breeze. Mails started getting sent to users instantly and the latency was reduced from stupid Godaddy's 10 mins or more to within a minute. I highly recommend it.

Aakash
  • 3,101
  • 8
  • 47
  • 78