PEAR Mail is so slow, my front end is timing out
I've got a php script that sends a few emails and echoes a response back to my front end.
The problem is that the email handling is so slow, the front end is timing out. Here are the broad strokes for the email开发者_开发问答 implementation.
The scenario kicks off when User A books an offer from User B. User A gets a confirmation email, User B gets a notification email and myself and 2 other employees get an email alert.
So that's 3 unique email messages and 5 addresses. And the tech specifics are:
- I'm using the Pear Mail class
- I'm using smtp as the mail type.
- I have authentication set to true.
I thought that the smtp transaction would be pretty straightforward. I assumed I'd handshake with the mail server, pass my message off into their queue and be free and clear. But it does seem that everything is hanging for quite a bit.
The Pear Mail Class is straightforward.
If you are using the host parameter as a URL (like domain.com) instead of an IP address the problem can rely on the DNS timeout, try using IP as the domain for the host (like $smtpinfo["host"] = "200.203.201.123";) instead.
精彩评论