Joomla: Sending mail takes ages
I have a Joomla website up and running and need to set up a simple contact form.
The problem is, whenever Joomla tries to send an email, the page will hang for about a minute before I get a response. The mail will ultimately be sent 开发者_如何转开发fine, but the delay is way too big. I've tried setting the outgoing mail setting to PHP Mail, Sendmail and an SMTP server, all with the same effect.
Curiously, if I edit components/com_contact/controllers/contact.php and replace the lines that send the mail with a simple call to mail(), everything works fine.
Using Joomla 1.6.5, CentOS5 with PHP 5.3.
Anyone experienced something similar? Thanks in advance!
(Also, is this a case for StackOverflow or ServerFault? It seems borderline!)
Updated: Narrowed this down to PHPMailer using uniqid to generate its boundary strings. It seems that on some platforms, uniqid (without the more_entropy flag) is extremely slow.
If anyone else ever comes across the same problem, edit libraries/phpmailer/phpmailer.php and in the first few lines of the CreateHeader() function, pass true as the second argument of uniqid(). Seems to have fixed it.
Narrowed this down to PHPMailer using uniqid to generate its boundary strings. It seems that on some platforms, uniqid (without the more_entropy flag) is extremely slow.
If anyone else ever comes across the same problem, edit libraries/phpmailer/phpmailer.php and in the first few lines of the CreateHeader() function, pass true as the second argument of uniqid(). Seems to have fixed it.
精彩评论