On Tue, Sep 6, 2011 at 2:59 PM, Matthias Andree <matthias.and...@gmx.de> wrote: > The problem is this: > > - I cannot connect to the remote SMTP relayhost via plain TCP, it's > firewalled on all ports. > > - The relayhost does not offer submission STARTTLS or SSL-wrapped legacy > ports. > > - I *can* (and am permitted to) connect to a computer in the same LAN as > the SMTP server by SSH. > > - The authentication infrastructure only supports SSH-2 public/private > key authentication. > > > The current solution is (options are: -f = background, -M = master, so > as to keep the command alive, -N = no command, -L = port forward) > > ssh -f -M -N -L 9999:mailhub.example.org:25 sshgate.example.org
After a couple of minutes of playing around, I can: pblair@pblair-laptop:~$ cat test-message.txt | ssh popc...@example.com "~/bin/smtp-cli --host=mail.EXAMPLE.COM --auth --user=popcorn --pass=******** --to=recipi...@example.com --from=sen...@example.com --data=-" Using http://www.logix.cz/michal/devel/smtp-cli/ as the SMTP CLI client. You could hack up a local perl SMTP listener on you local system, which when it receives all of the SMTP back and forth, and then the ".", it executes a SSH subshell, formatting the recipient/sender etc via the gateway, and pipes the DATA portion over its FH. Good luck!