PHP not sending emails? You need a mail transfer agent (MTA). If you’re in the Ubuntu platform, you can use postfix for this:
sudo apt-get install postfix
You can read on more information here.
Previously my Contact Form 7 WordPress plugin didn’t work, it works fine after I install and configured postfix. I can’t go through the specifics of the configuration with you since yours would probably differ. I selected “Internet Site” and press the return key (Enter) all the way selecting the default options. On doing so, Contact Form 7 starts to work already.
Should you need to configure postfix again, you can reconfigure too:
sudo dpkg-reconfigure postfix
Contact Form 7 uses WP_Mail which uses PHP’s mail() function. If you do need to troubleshoot, try sending emails with mail().
If you need additional configuration, you may need to update the following:
- Settings SMTP and smtp_port need to be set in your php.ini
- Also, either set the sendmail_from setting in php.ini, or pass it as an additional header.
I did not have to configure anything more than postfix. I am using Ubuntu server, on nginx web server.