通过PHP的电子邮件延迟短信发短信

I'm currently using a php class that simply sends texts by using the email-to-text gateway that each carrier uses (e.g. XXXXXXXXX@tmomail.net for T-Mobile), but that has 2 problems - the first is that there seems to be a random delay before the text is received, and this can be lengthy, and secondly if you don't know the target carrier you're stuck with sending a email to every carrier's email gateway.

I've tried to solve the first problem by using various email methods, from simply using php's mail to using Swiftmailer to send via a 'real' gmail account and makes no difference. Which is odd, because I find if I manually do this via my own email client I don't get such length delays, even when using the same Gmail account?

Alternatively, I could go with a service like Clickatell, but was wondering if anyone else has experienced these issues? I only need to send a small number of texts.

It's possible the SMS gateways are greylisting, but seems unlikely as it would defeat the immediacy of SMS. Are you certain that the server's SMTP service isn't simply backed up with outbound messages? That could explain why your own client doesn't experience the same delay.

This is the main drawback with using email-to-text gateways -- email is not, nor was it ever intended to be, an instant medium. You've got possibly multiple gateways, queues, content scanners, etc. to deal with. If you want an instant response, you simply can not rely on it. I doubt you'll find any carrier that's going to guarantee any sort of quality of service for their email-to-text gateway -- it's simply a feature of convenience. True SMS gateways like Clickatell should give you much better performance -- which is why they're not free.

Alternatively, if you only need to send a handful of messages, you might be able to hack something through Google Voice, though I'm not sure offhand what sort of features are available through their API.

I don't have anything technically impressive to add, but I ended up going with Nexmo. Super easy to setup.