Install SMTP client on Ubuntu server

Posted on 26.09.17   Linux SSMTP Ubuntu

  1. Install the light-weight SMTP client “ssmtp”
    sudo apt-get update && sudo apt-get install ssmtp

  2. Configure ssmtp (sudo nano /etc/ssmtp/ssmtp.conf) [1] and set correct info for the following lines:
    1. root=
    2. mailhub=
    3. AuthUser=
    4. AuthPass=
    5. hostname=
    6. rewriteDomain=

  3. Make aliases for the local user to correct email address [2]
    sudo nano /etc/ssmtp/revaliases

  4. ssmtp uses the local users Full name from the OS as the email sender, so make sure your name is correct. Change by using command
    sudo chfn -f "John Doe" yourUser

  5. Verify ssmtp works by sending a test mail with command [3]
    ssmtp recipient@example.com

 

[1]: Example config

# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=kek@it-db.com

# The place where the mail goes. The actual machine name is required no
# MX records are consulted. Commonly mailhosts are named mail.domain.com
mailhub=smtp.it-db.com:587

AuthUser=johndoe
AuthPass=123456
UseTLS=YES
UseSTARTTLS=YES

# Where will the mail seem to come from?
#rewriteDomain=

# The full hostname
#hostname=MyMediaServer.home
hostname=it-db.com

# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
FromLineOverride=YES

 

[2]: Example aliases

# sSMTP aliases
#
# Format: local_account:outgoing_address:mailhub
#
# Example: root:your_login@your.domain:mailhub.your.domain[:port]
# where [:port] is an optional port number that defaults to 25.

kek:noreply@it-db.com

 

[3]: Example ssmtp test

ssmtp recipient@example.com
Subject: Testing ssmtp
enter your body text here
via SMTP server.
^d

 

More on ITDB

Change Resize Mode for all VMs in RoyalTS 4


How to debug a non starting application with ProcMon


Telnet alternative to check if port is open on host


Finding the source for locked AD account from Event Viewer log on Domain controller


Create a cmd alias/shortcut for issuing commands on remote computer