php mail function is very slow + wordpress didn't send mail

I host my another site on my own server [ubuntu+apache+wordpress] and notice that notification mail function on my site is not work. After install sendmail, php mail function is working fine but very slow. If you also have this problem, below is how i fix it. first make sure your /etc/hosts file first line look like this       localhost.localdomain localhost yourhostname
hostname can found on /etc/hostname. Now php mail function should work correctly. But wordpress still deny to send mail out. This have to fix with little hack[ i don't have other better way yet ].

1. edit file "wp-includes/class-phpmailer.php".
2. Looking for the line 'public $From = 'root@localhost';'.
3. Change root@localhost to something else like name@yourhost.com. I don't know why but this work for me. :)


Fred Martin said...

If you have programmed headers do not adopt post-values unfiltered!!
Often used in scripts, and often abused by spam mailings:

If somebody posts email="me@example.com
(with linebreak behind me@example.com)

You get following headers:

From: me@example.com

Php Application Development