开发者

cakephp Activation Email Sending slow

I have a simple email sender for user account activation. Depending on which email address I use, I get significantly different response times: Un开发者_C百科iversity email - 1 minute, Gmail - 3-4 hours, Yahoo - 1 or 2 days -- which seems bizarre. Has anyone else seen this phenomenon?

EDIT:

There weren't many responses (even for a bounty), but I'll try to explain my problem more clearly.

This probably isn't greylsting -- If I so a simple:

php mail ($to, $subject, $body) // this delivers instantly.

My cakephp code:

    function __sendActivationEmail($id) {
    $User = $this->User->read ( null, $id );
    $this->set ( 'suffix_url', $User ['User'] ['id'] . '/' . $this->User->getActivationHash () );
    $this->set ( 'username', $User ['User'] ['username'] );
    $this->Email->to = $User ['User'] ['email'];
    $this->Email->subject = 'Test.com - ' . __ ( 'please confirm your email address', true );
    $this->Email->from = 'noreply@test.com';
    $this->Email->template = 'user_confirm';
    $this->Email->sendAs = 'text';
    $this->Email->delivery = 'mail';
    $this->Email->send ();
}

Causes delays from 13 minutes (ok; we'll deal with it) to 5-6 hours (less okay, since this is an activation email). For some of my users, it works instantly, but for other users (of the same service provider, i.e., gmail, it sees these delays).

Any clues?


The code looks fine, but it of course doesn't tell anything about the mail server's configuration. 3-4 hours I would put down to Greylisting, but 1-2 days is definitely too much. Is this reproducible? How many addresses have you tried this with?

What do the full headers of the (received) mails look like? The "received from: .... "path should tell you at which point it took 1-2 days to deliver.


Maybe you can install PHPMailer as a Vendor and create a Component called "Mail"...

And don't forget to authenticate with your SMTP server! :)


Ignore the whole PHP element of it for a moment.

If its a linux server for example, send a mail from the command line e.g. mail myemail@me.com

see if the same thing is happening that way. Its quite likely its a server configuration issue not a php or cakePHP issue.

Look up a few basics like having a FQDN and maybe look into setting up SPF records for your email. Make sure the emails are coming from your domain name not someone elses e.g. not the users email.

Also check if you have email spam software set up that could be grey listing you email on the way out (unlikely but possible). the mostly like thing is the destination spam filter is delaying it. Try send to a gmail account and see if it gets through fine or goes into spam.

Do all this without touching PHP, if all is going fine there then set up a basic php script to do a basic email not using CakePHP, if that works fine then you know its CakePHP etc but I doubt it.


So after further digging, I realized that it was our server host's problem. We use Slicehost, and it just so happens that a range of ips that had been blacklisted included our own ip. We got our name off the list, and we're good to go.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜