On Fri, Sep 24, 1999 at 11:42:25PM +0200, Richard P. Groenewegen thus spoke:
> > > I think he wants to save a FCC into *both* mailboxes for every message.
> > > And no, I don't know how to do that. :-(
>
> > The solution I would use would be to do something like the following:
> >
> > my_hdr X-OutboundMultiStore: mailbox_target_name
> > # or some other unique header
> >
> > And then just cc: yourself on every message and use .procmail and it's "c"
> > option to do multiple saves based on whatever your major outbound folder
> > is, and then one based on a script that would parse that line and append to
> > that target folder...
>
> I thought about this, and I would know how to write such a .procmail,
> but still it would seem that there should have been some easy way to
> do this from mutt. I can also send messages to multiple persons, so
> why can't I use multiple Fcc-addresses (mailboxes)?
Script:
#!/bin/csh -f
#
# define storage directory
set dir="/home/someuser/folders/"
# set temp filename
set tmp="/tmp/$$.multistore"
#
# save temp file with email
cat - > ${tmp}
#
# get secondary filename that could have been set by hook, etc
set filename=`grep "^X-OutboundMultiStore:" ${tmp}`
#
# set full filename
set fullpath="${dir}${filename}"
#
# save mail to second folder
cat ${tmp} >> ${fullpath}
#
# remove temp file
rm -f ${tmp}
#
# Elvis has left the building
exit 0
# EOF
That's the script. Assume we call it "multistore"...here's the procmail:
# recipe
:0
* ^From:.*[EMAIL PROTECTED]
* ^X-OutboundMultiStore:
{
:0c:
/home/someuser/folders/defaultsavefile
:0
| /path/to/multistore
}
# end recipe
Untested, but it's based on one of the first examples on the procmailex man
page, so I see no problems.
In short, the recipe's beginning checks not only for the special header,
but also for who it's from...so that it can only be triggered if you set
that header (cuts down on malicious abuse). Then the first part of the
disposition block saves to the default outbound file, and makes a copy of
the messge to pass on down to be piped to the second disposition, which is
a pipe to the script, which does the rest.
The procmailex example didn't use a second : to lock the file saved to, but
I think the man page was wrong...you should always check for locks when
saving to a folder. None is needed for the pipe.
Enjoy. Think I'll keep this around myself, just in case. ;)
mark->
> --
> So what's the speed of dark?
Faster than the speed of light, since drkness spreads faster than light
across our society. :(
A crappy proof for FTL travel. 8^)
mark->
--
Fairlight-> ||| [EMAIL PROTECTED] | Fairlight Consulting
__/\__ ||| "I'm talking for free... | http://www.fairlite.com
<__<>__> ||| It's a New Religion..." | [EMAIL PROTECTED]
\/ ||| PGP Public Key available via finger @iglou, or Key servers