A friend installed contact form 7 on his website to receive customer inquiries, but failed to receive emails after repeated tests. After thinking, Weieis Blog believes that the mail function of vps in the lnmp environment can't send mail normally. The solution is to reinstall the sendmail component. Let's talk about the lnmp environment Contact form 7 cannot send email The resolution process of.
![](https://img.vpsss.net/wp-content/uploads/2017/09/ldmaba01-1.png)
The following operations passed the test in Linode and CentOS. The virtual host on bluehost is not suitable for this method 。
1. To prevent the sendmail component from being installed before, we need to remove the sendmail component first.
yum -y remove sendmail
Run the command to install sendmail components.
yum -y install sendmail
2. Restart the php fpm process
/etc/init.d/php-fpm restart
3. Start sendmail
/etc/init.d/sendmail start
A friend said that the startup speed is slow. Anyway, I show that running is running in a few seconds, so it can be used.
4. Check sendmail status
/etc/init.d/sendmail status
5. Modify php. ini to enter the absolute path of sendmail. Use the command to open and edit php.ini
vi /usr/local/php/etc/php.ini
Enter? Sendmail_path search location, you will find the following code
; sendmail_path =
Press i to enter editing, and change this line to
sendmail_path = /usr/sbin/sendmail -t -i
Press Esc to exit editing, and enter: wq to save and exit.
6. Restart the php fpm process again.
/etc/init.d/php-fpm restart
At this time, the sendmail component can run normally. Go to the website and send a test email. The email will be received soon.