PHP Mail Script Sends After Awhile

nostradamus

New Member
Messages
10
Reaction score
0
Points
1
Hi, everyone. I'm trying to test out a PHP mail script using Mail(). This is apparently supposed to be very simple to execute, however, I noticed that the emails that I send to myself while using this script don't arrive in my inbox until perhaps a few days or hours.

Does anyone know why this would be? I am a beginner at sending Emails with coding and I would love some assistance with this one.

Thank you!
 

essellar

Community Advocate
Community Support
Messages
3,295
Reaction score
227
Points
63
It's not what you're doing that's the problem. Oh, rather, there's probably nothing wrong with your code. If the mail gets there at all, you've done it right. The problem is that there's an awful lot of traffic on the servers here, all of which is checked on the way out for quantity/frequency, header spoofing and phishing attempts, and a lot of not-mail stuff weighing the system down as well.

There are two services I suggest people look at for different reasons. (They're both from the same company, which might raise some red flags for you. I have no connection with the company at all, other than that I have used them for clients. Whenever anyone suggests anything like this, do your own research on the web first before acting—you don't want to get burned or involved in anything shady. And this is not the only company doing it; they're just the one I know best.)

For newsletters and marketing-type mail, take a look at MailChimp. For transactional email (sign-up confirmation, contact forms, password reset links, that sort of thing), then look at Mandrill. In both cases, you are sending using somebody else's server by calling a web API (and they have PHP code you can use), so even when x10's mail system is swimming in molasses, your mail will still go out on time. And both services have pretty generous free-level terms, so a small site won't cost you anything. (Well, unless your users are the sort of people who forget their passwords eighty times a day each. Or you're the type who thinks an email newsletter blast every day is a good idea.)

Again, shop around before deciding. But I think you'll find that using an outboard service will work out a whole lot better. (Do note, though, that you might have to get your own domain, since there are users here from time to time who insist on hightening the "risk profile" of the x10Hosting-owned domains.) You can always use the PHP mail() call as a fallback when service is not available through the API.
 
Top