It/Software/System Config/SSMTP

From msgwiki
Revision as of 14:30, 8 May 2024 by Itvte (talk | contribs) (Add usage examples)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Access restrictions were established for this page. If you see this message, you have no access to this page.

SSMTP is a mail client for Linux that provides the sendmail command and is compatible with SSL/TLS.

Installation and setup

To install, run

sudo apt install ssmtp

To setup, modify the /etc/ssmtp/ssmtp.conf file:

#
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=donotreply@msgeducation.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=mail

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

# The full hostname
hostname=localhost

# 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

mailhub=sl-507-7.slc.westdc.net:465
rewriteDomain=msgeducation.com
AuthUser=donotreply@msgeducation.com
AuthPass=account-password
FromLineOverride=YES
UseTLS=YES
Debug=YES

Usage

sendmail will be used by existing system services, such as crontab and mdadm. You can test the configuration by running a crontab that produces output.

You can also send mail through the command line, but as the tool is not intended for that it's a bit sloppy. If you want a tool that abstracts ssmtp a little bit and makes sending email easier, install mailutils

sudo apt install mailutils

With mailutils, run the following to send an email:

echo "Email body and content" | mail -s "Email subject" your_recepient_email@yourdomain.com

Without mailutils, you can use sendmail.

  1. Run the sendmail command to open the session
  2. Type in the email headers; hit enter twice so there is a blank line
  3. Type in the email body
  4. Press Ctrl-D to send
$ sendmail it@msgeducation.com
To: it@msgeducation.com
From: donotreply@msgeducation.com
Subject: Hey its an email what do you know

Test email to it@msgeducation.com
<Ctrl-D>