<<< Date Index >>>     <<< Thread Index >>>

Re: send-hook -> pipe_message



On 13/07/04 14.44, Ben Livingood wrote:
> * Mads Laursen (dossen+mutt@xxxxxxxxxxx) wrote thusly unto the masses:
> > Something like this can be leveraged to do any number of additional
> > actions on outgoing mail (I use somethin similar with ssh as MTA to
> > avoid having sendmail on some machines, where only my user needs to
> > send mail), and if you find that you need it you have access to the
> > arguments to sendmail as well (those are the addresses that mutt is
> > actually trying to send the mail to).
> 
> Could I see the script that you are using [with any sensitive data
> omitted if you wish?]

Certainly. I'm also sending to mutt-users, lets keep public
discussions public.

I have replaced the name of the server with $HOST and the username
with $USER. The script needs ssh-agent authentication, since there is
no terminal to ask for passwords on (maybe something could be cooked
up with a graphical password prompter, please share if you make such a
script).

The script defaults to using system sendmail, since I also use this
mutt configuration on boxes with sendmail installed (and I'm too lazy
to maintain two configs).

/dossen
 
#!/usr/bin/env bash
if [ -x /usr/sbin/sendmail ]; then
    /usr/sbin/sendmail "$@"
elif [ -x /usr/lib/sendmail ]; then
    /usr/lib/sendmail "$@"
else
    if ssh-add -l >/dev/null; then
        ssh -q $USER@$HOST /usr/sbin/sendmail "$@"
    else
        echo "Agent authentication not available." >&2
        exit 1
    fi
fi

Attachment: pgpqTIGhcJrsW.pgp
Description: PGP signature