Re: save 2 copies of outgoing mail
* Crni Gorac <cgorac@xxxxxxxxx> [2006-02-21 15:37 +0100]:
> On 2/21/06, Nicolas Rachinsky <mutt-users-0@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> > * Crni Gorac <cgorac@xxxxxxxxx> [2006-02-20 19:08 +0100]:
> > > I have number of fcc-hooks routing my outgoing mail to appropriate
> > > folders, as well as $record set for routing rest of messages to
> > > "outbox" folder. However, I want second copy of each of my outgoing
> > > message to be copies to "ham" folder (in order to fed bogofilter from
> >
> > Make $sendmail do it for you. A little script should be ablte to do
> > this.
>
> Any concrete suggestion if $sendmail == msmtp?
I haven't tested the following script (and it assumes your ham folder
is an mbox, and the locking is the same other processes accessing your
ham folder use).
#!/bin/sh
set -e
# do _not_ use /tmp here, if you do, an attacker can do nasty things
mytmp="~/.tmp/`basename "$0"`.$$"
lockfile ham.lock
cat >"$mytmp"
formail >> ham <"$mytmp"
msmtp "$@" <"$mytmp"
rm -f ham.lock
rm "$mytmp"
EOF
Please note, I did not test this and it probably contains one or more
bugs.
Nicolas
--
http://www.rachinsky.de/nicolas