Ssh – Configuring mutt to send e-mail over an SSH tunnel

muttsmtpsshssh-tunnel

I want to be able to send email from mutt through an SSH tunnel I can SSH into the SMTP server, but I don't know how to tell mutt how to use the tunnel to send e-mail.

Can someone help me out, please?

Best Answer

Using remote SMTP is described here: https://gitlab.com/muttmua/mutt/-/wikis/MuttFaq/Sendmail

So with the tunnel you'd set up your SMTP to localhost, but with the tunnel port. Eg. you create tunnel 8025->25 on remote:

ssh -L8025:smtp.example.com:25 serv.example.com

And in Mutt configuration (.muttrc) you put:

set smtp_url="smtp://username@localhost:8025/"

BTW. Using remote POP/IMAP here: https://gitlab.com/muttmua/mutt/-/wikis/MuttFaq/RemoteFolder