Server Sendmail

Installation of sendmail in the server droplet / machine

This guide is focus more on Linux OS

  1. Firstly, install Sendmail using the command:

$ sudo apt-get install sendmail
  1. Now configure /etc/hosts file. To find the hostname, use the command:

$ hostname
  1. Then type the command:

$ sudo nano /etc/hosts
  1. On the line starting with 127.0.0.1, add the hostname to the end so it looks the same as:

$ 127.0.0.1 localhost hostname
  1. Now press Ctrl+x, then β€˜Y’ to save and exit.

  2. Run Sendmail’s config and answer β€˜Y’ to everything

$ sudo sendmailconfig
  1. Now restart Apache with the command:

$ sudo service apache2 restart

πŸŽ‰Congrats!, your server can now send an email using our recruit application.


Need to test if working fine?, follow steps below.

  1. You can use the following instructions to send email using the sendmail command:

$ sendmail email_address < file.txt

For example, I have created a file file.txt with the following text:

Hello there !
  1. The command for sending the message will be:

$ sendmail < file.txt james@example.com

You can use -s option to specify the email subject.


Reference: https://www.digitalocean.com/community/tutorials/send-email-linux-command-line

Last updated