How to install and configure Sendmail on Ubuntu
Install Sendmail on your Ubuntu server in couple minutes
This tutorial will guide you on how to install and configure Sendmail on Ubuntu. It is made the way you can simply copy and paste the necessary commands and setting.
Log in as root (
apt-get update && apt-get upgrade
Start with the customer – find out what they want and give it to them.
sudo apt-get install sendmail
Done, as simple as that.
The fastest way is to edit
If you have a domain update the top two lines with(to get hostname just type hostname in terminal):
127.0.0.1 localhost.localdomain localhost your-server.com
If you don't have a domain yet you can use:
127.0.0.1 localhost hostname
Run Sendmail config and answer Y for everything:
Apply the settings and start using
If you are using Apache then restart it:
sudo service apache2 restart
If you are using Nginx you will have to restart Nginx as well as fpm:
sudo service nginx restart
service php7.0-fpm restart
Test if Sendmail is working
The best way to do this is by sending the test email:
echo "test message" | sendmail -v firstname.lastname@example.org
Can't see this in your mailbox? Check the spam folder. If you are not using any domain it is likely that emails will land in the SPAM.
stuff and resources
Some basic commands:
sudo /etc/init.d/sendmail restart
sudo /etc/init.d/sendmail stop
sudo /etc/init.d/sendmail start
Remember to update your DNS(if your emails are landing in the spam):
- go to whoever hosts your domain(GoDaddy, Route53 etc.)
- enter the hosted zone for the domain and add a TXT entry with VALUE: "v=spf1
- this will allow receivers server recognize the email as actually coming from the domain