Everyone 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:
#!/bin/bash
files=(/home/user/.MSMTPconfigs/*)
# Grab a random config file
n=${#files[@]}
SMTP=”${files[RANDOM % n]}”
# make the random config file the .msmtprc
cp $SMTP /home/user/.msmtprc
As an Amazon Associate I earn from qualifying purchases. Read our Privacy Policy for more info.