If your email can’t work in LNMP or in centos, why not change it to Postfix? Which is simple and faster than sendmail!
What is Postfix? It is Wietse Venema’s mail server that started life at IBM research as an alternative to the widely-used Sendmail program. Now at Google, Wietse continues to support Postfix.
Here we go!
yum remove sendmail
Then we can install postfix now!
Install Postfix
yum install postfix
Change the default MTA to Postfix
/usr/sbin/alternatives --set mta /usr/sbin/sendmail.postfix
OK, recheck it changed to postfix or not
alternatives --display mta
Edit Postfix, use vi to edit the main.cf
vi /etc/postfix/main.cf
Open the main.cf, remove the # and edit
myhostname = mail.dobeweb.com mydomain = dobeweb.com myorigin = $mydomain inet_interfaces = all mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain mynetworks = 192.168.100.10/28, 127.0.0.0/8 relay_domains = home_mailbox = Maildir/
Here is the full file of main.cf, what you need to do is change our domain dobeweb.com to your own domain.
If you don’t love vi to edit online, you can download the main.cf and upload to your server /etc/postfix/main.cf to replace the default one.
Test and start the Postfix
service postfix status
// if the postfix didn’t start, use the following command,
service postfix start
Set it start when you start your server
chkconfig postfix on
OK, you have installed the Postfix, but wait, you need to edit the sendmail path in php.ini
Edit the php.ini
vi /usr/local/php/etc/php.ini
Use ?sendmail_path to find the sendmail_path, you will find the default setting as follow:
;sendmail_path =
Press “i” to edit, change it into
sendmail_path = /usr/sbin/sendmail -t -i
Press Esc to quit, then use :wq to save and quit.
Restart the php-fpm
/etc/init.d/php-fpm restart
OK, test your email now!