We've tried PHP's mail() function and also the PHPMailer SMTP library, but are experiencing delays with both.
We're working on a web service, and our registration confirmation emails are constantly delayed almost 5-10 mins on GoDaddy's servers.
First, determine if any of the third-party software is the culprit. Maybe your PHP script runs slowly to the point where it takes 5 minutes before the
mail() function completes.
Try sending mail a couple of times using the most basic fully functional email client on the server and see how long it takes. If the time is roughly 5 minutes each time, then you may need to restart or reconfigure the email processing software (exim?) on the server. I found that when I run into this situation, and reconfigured the mail server (so no errors exist or appeared in the logs), the mail was being processed quickly again.
We want to receive emails immediately.
Depending on how far the email travels, I'd suggest waiting at least 1 to 2 seconds each time your server sends mail to a client before claiming that it is sent.