Home » Configs » MSMTP randomize your outgoing SMTP servers

MSMTP randomize your outgoing SMTP servers

emailEveryone knows that there is no privacy in our communications, including email. While we can’t stop that, we can make it harder for them.

MSMTP randomize your outgoing SMTP servers

I don’t run a mail server these days, so I run MSMTP to send outbound mail from my Linux boxes. I don’t want every email that I send out to go to the same smtp server, so I’ve randomized things a bit.

I have a folder with multiple msmtprc files in it “.MSMTPconfigs”.

ls ~/.MSMTPconfigs/
msmtprc.fastmail  msmtprc.gmail  msmtprc.hotmail  msmtprc.secretmail.org

Obiously you need to know how to create some msmtprc files. This is a sample for Gmail:

#sample file

account gmail
host smtp.gmail.com
from your-username@gmail.com
auth on
user username@gmail.com
password SecretPassword
# Use TLS.
tls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
# Syslog logging with facility LOG_MAIL instead of LOG_USER.
syslog LOG_MAIL
account default: gmail

You’ll want to have a handful of free email servers that you can “relay” through and create msmtprc files for, Gmail, fastmail.fm, hotmail, outlook.com are all good enough!

Then I have a script that runs from cron every 5 minutes or so:

# Grab a random config file
SMTP=”${files[RANDOM % n]}”
# make the random config file the .msmtprc
cp $SMTP /home/user/.msmtprc

That’s it, every 5 minutes my smtp server is randomly selected.
If you are a Windows or Mac user, fear not.
Thunderbird has an extension (add-on) called SmtpSelect, which lets you select your outbound SMTP server. Make sure to select a different SMTP server for each outbound email, forward and reply that you make!


As an Amazon Associate I earn from qualifying purchases. Read our Privacy Policy for more info.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.