[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [msmtp-users] Using msmtp with pine: roles (accounts)



On Wed, 9 Aug 2006 chatwin@...55... wrote:

This is my 'chapuza' (quick fix) to get roles in Pine to work with
MSMTP. (I would really like to know how to do it inside Pine so that
I could use it on PC-Pine too.)

Copy  msmtp-enqueue.sh to msmtp-enqueue-pine.sh.
Change (and swap order) 2 lines in msmtp-enqueue-pine.sh as follows:

## ################################
## BEGIN CHANGES (PINE) TO ORIGINAL
##
#
# Write command line to $MSMTPFILE
#echo "$@" > "$MSMTPFILE" || exit 1
#
# Write the mail to $MAILFILE
#cat > "$MAILFILE" || exit 1
tee "$MAILFILE" |\
# Now write command line to $MSMTPFILE including '-f sender' option
echo "$@ -f `formail -r -X To: | sed 's/To: //'`" > "$MSMTPFILE" || exit 1
#
##
## END CHANGES (PINE)
## ################################

My path to the msmtp executables is  /usr/local/bin/. So...
in .pinerc, I set:

sendmail-path=/usr/local/bin/msmtp-enqueue-pine.sh -t

A couple of tweaks. With formail (only 28k!), sed isn't needed. Just use
the '-x' (lower case) flag instead of '-X' (upper case).

And I am happier with '-rt' instead of '-r' (explained below).
For the new version of 'msmtp-enqueue-pine.sh':

## ################################
## BEGIN CHANGES (PINE) TO ORIGINAL msmtp-enqueue.sh:
##
##
## Replace 2 lines:
#echo "$@" > "$MSMTPFILE" || exit 1
#cat > "$MAILFILE" || exit 1
## with
tee "$MAILFILE" |\
echo "$@ -f `formail -rt -x To: `" > "$MSMTPFILE" || exit 1
##
## Which writes the mail to $MAILFILE as before
##  and the command line to $MSMTPFILE but now appending '-f sender'
## Note: 'formail -rt' picks the "trusted sender" -- the 'Reply-To:'
##  if it exists, in preference over the 'From:'
## Use simple 'formail -r' if you're happy with the 'From:' ##
## END CHANGES (PINE)
## ################################

Regards

R A Chatwin
Badajoz, Spain