Skip to content

Instantly share code, notes, and snippets.



Created May 18, 2020
What would you like to do?
ubuntu email setup through dreamhost relay with msmtp

usage of msmtp for email relay through dreamhost

I just needed the sendmail cli interface to work for things like bts or the occasional sending of an email.

msmtp seems like a good solution.

Heres what I did to get it functional

  • install mtsmtp-mta

    sudo apt-get install msmtp-mta
  • configure client

    I have only configured per-user, not site-wide. (so only my user can send mail, not 'root' or others). You can do that, I just haven't.

    See the .msmtprc file below.


# this is my ~/.msmtprc
port 587
tls on
account primary
# Host name of the SMTP server
# Envelope-from address
from Scott Moser <>
# Authentication. The password is plaintext here. I have a "relay only" account
# that can send mail and has a tiny receive quota. You can send mail from
# other addresses using that address
auth on
password SECRET
account default : primary
# just a simple test of using sendmail.
# call it with: [to [from]]
cmd=${CMD:-sendmail -vt}
$cmd <<ENDEND
To: ${to}
Subject: Testing that sendmail works. sent $(date +%H:%M)
${from:+From: $from}
I just wanted to see if this works.
testing using msmtp
Here I did not use the And here goes the e-mail body, test test test..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment