Email Setup Center
  • Home »
  • Sendmail Specify Your Server

How To Setting Up Sendmail Specify Smtp Server?

To configure your mail server to send outgoing emails to a specific server, you have to set up your SMTP relay with Sendmail. For setting up sendmail specify SMTP server, carry out the following simple steps.

Sendmail Specify SMTP Server

Step 1

  • Step 1:Open Terminal on your Linux computer.
  • Step 2:Type ssh root@X in the Terminal window and press the Enter key. Note: Replace X with the IP address of the server.

Step 2

  • Step 1:Wait until you see a security alert in the Terminal window.
  • Step 2:Type Yes and press the Enter key.
  • Step 3:When prompted, enter your password to log in via SSH.

Step 3

  • Step 1:To edit the Sendmail configuration file, enter the vim /etc/mail/sendmail.mc command line.

Step 4

  • Step 1:Remove the comment for the following line in the sendmail.mc file.
  • Step 2:dnl define(‘SMART_HOST,’ ‘smtp.your.provider’)dnl
  • Step 3:Replace this line with the following commands.
  • Step 4:define(`SMART_HOST', `smtprelay.snel.com')dn
  • Step 5:define(`RELAY_MAILER',`esmtp')dnl
  • Step 6:define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl

Step 5

To regenerate the configuration line, enter /etc/mail/make in the Terminal window.

Step 6 (Optional step)

  • Step 1:If you want to add authentication while setting up sendmail specify SMTP server, perform the following instructions.
  • Step 2:To change to mail configuration directory, enter the cd /etc/mail command line.
  • Step 3:In the Terminal window, type the commands given below.
  • Step 4:vim /etc/mail/authinfo
  • Step 5:AuthInfo : smtp.domain.com “U : USERNAME” “P : PASSWORD” “M : PLAIN”
  • Step 6:Enter the makemap hash authinfo < authinfo command to create a hash map.
  • Step 7:To add Authinfo to sendmail config, enter the following command lines.
  • Step 8:vim /etc/mail/sendmail/mc
  • Step 9:FEATURE(‘authinfo’)
  • Step 10:Regenerate the Sendmail Configuration file by entering the /etc/mail/make command.

Step 7

Type service sendmail restart and press the Enter key to restart the mail server.

Step 8

  • Step 1:Enter the echo "Test 1 from $(hostname -f)"|mail -s "Test 1 $(hostname -f)" to@example.com command line in the Terminal window.
  • Step 2:Finally, you have finished sendmail specify SMTP server process.