SMTP via SSH

Published: Wednesday, Dec 26, 2007 Last modified: Monday, Apr 8, 2024

SMTP can be blocked at ISPs to prevent spammers.

Use a shell script with this [[ssh access to a remote machine|e/01013]].

$ cat /usr/sbin/sendmail
#!/bin/sh
ssh sg.webconverger.com /usr/sbin/sendmail "$@"

This is a less suckier solution than running msmtp or esmtp, since you rely on your ssh credentials, not some saved password on your filesystem.

You can configure mutt MUA to use a specific sendmail binary like so:

$ egrep sendmail .muttrc
set sendmail = "/home/hendry/sg-sendmail"