[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [msmtp-users] pre-connect?
On Sat, May 22, 2010 at 01:50:36PM -0400, John Eikenberry wrote:
> I currently use esmtp's preconnect functionality to ssh to my work's mail
> server and send out email. They use SPF so I can't spoof and they don't
> support remote SMTP connections. The ssh tunnel works fine and I have been
> happy with it. But now I'm looking to switch MTAs due to unrelated
> problems.
>
> msmtp looks almost perfect except for the lack of pre-connect like
> functionality to establish the ssh tunnel for the smtp connection. I can't
> seem to find it in the docs but thought I'd check here in case I missed it
> or if someone had some alternative approach they could suggest.
There may be a better way than this, but if nothing emerges, what's
wrong with something like this...
#!/bin/bash
ssh -set -up -your -tunnel &
SSH_PID=$!
sleep 1 # I'm sure there's a better way...
if [ -d /proc/$SSH_PID ]; then
# ...but at this point, we can assume the ssh tunnel is up
# and we know the PID of its process, so...
msmtp "$@" # receives stdin
killall $SSH_PID
fi
--
Jim Pryor
profjim@...173...