Install and Configure Sendmail on Ubuntu
If you have setup a new server and your PHP mail()
function is failing, it's just because Sendmail isn't installed on your server. So, Here we'll let you know some simple setps to fix this problem.
To Configuring Sendmail on Ubuntu, you need to run following commands on your server.
Install Sendmail on Ubuntu
saveCopyzoom_out_mapsudo apt-get install sendmail
Update your hosts file
saveCopyzoom_out_mapsudo nano /etc/hosts
Make sure the line something like below at the top:
saveCopyzoom_out_map127.0.1.1 yourhost yourhost 127.0.0.1 localhost
Change the second line to look like this, where yourhost is the same as whatever is in the line above it.
saveCopyzoom_out_map127.0.0.1 localhost localhost.localdomain yourhost
Save the file and then Run Sendmail's config command and answer Y
to everything:
saveCopyzoom_out_mapsudo sendmailconfig
Sendmail Installation and Configuration is done. Now Finally you need to Restart Apache. Run the following command to restart Apache services:
saveCopyzoom_out_mapsudo service apache2 restart
Bingo!! Sendmail is now installed and configured, and your PHP mail() function is working and it will send mail quickly now.
I hope this article helped you to know How to Install and Configure Sendmail on Ubuntu .
Bookmark it for your future reference. Do comment below if you have any other questions or doubts.
P.S. Do share this post with your team.