About saving outgoing messages

2015-09-29 Thread steve

Hi there!

Let's say I'm sending a message to mom and dad and writing it from the 
Inbox folder. Once this message is sent, it is saved in $record=Sent 
folder.


Now if I write the message from within the family/mom folder, it gets 
saved in the family/mom folder since I have defined


set record=+family/mom

in a file being sourced when I enter the family/mom folder.

but I don't have a copy of this message in the family/dad folder.

So I have two questions here. First, say I have n recipients in the 
From: line, is it possible to save a copy of the message n times, each 
in the right folder? If so, how can I do that (and as a corollary, is it 
a good policy?)


A second, how can I manage to save a message in the right folder even if 
I'm not writing it in that folder?


I've been playing with folder-hook and fcc-hook but never managed to get 
where I would like.


Thanks for any help.

 Steve


Re: About saving outgoing messages

2015-09-29 Thread Cameron Simpson

On 29Sep2015 15:18, steve  wrote:
Let's say I'm sending a message to mom and dad and writing it from the Inbox 
folder. Once this message is sent, it is saved in $record=Sent folder.


Now if I write the message from within the family/mom folder, it gets 
saved in the family/mom folder since I have defined


set record=+family/mom

in a file being sourced when I enter the family/mom folder.

but I don't have a copy of this message in the family/dad folder.

So I have two questions here. First, say I have n recipients in the 
From: line, is it possible to save a copy of the message n times, each 
in the right folder? If so, how can I do that (and as a corollary, is 
it a good policy?)


A second, how can I manage to save a message in the right folder even 
if I'm not writing it in that folder?


I've been playing with folder-hook and fcc-hook but never managed to get where 
I would like.


Mutt has a few mechanisms for deciding where to save outbound messages, but 
each will cause mutt to only save it once. Hmm; I think. It is possible that 
$save_name might to it for every recipient - the documentation (man muttrc) 
speaks in terms of a single recipient.


This leaves you with two choices:

 - run with a suitable purely mutt system

 - create your own

For the former, look at $record (you use it already), $save_name and 
$force_name settings. It sounds like they won't quite do what you want.


For the latter, I use two approaches (at once!):

 - use a custom $sendmail program which takes copies of the message after 
   submitting it to the mail system


 - use my mail filing system to file multiple copies of the message

For the former, I use this script:

 https://bitbucket.org/cameron_simpson/css/src/tip/bin/sendmesg-fcc

which tries to dispatch the message normally (it calls "sendmesg", but that 
calls sendmail) and if that succeeds if files a copy of the message in every 
folder in the $SENDMESG_FCC environment variable. Personally, I contrive that 
to be the current mail folder and my "spool-out" folder, where more filing 
happens. That way a copy of the message is in the folder where the source 
message was, giving me the whole thread.


For the latter, this depends on how you file your email. I use my mail filing 
system to takes the extra copies of the message.


Most people who autofile their inbound email run something like fetchmail or 
getmail, and hand message delivery to a tool like procmail, so it looks like 
this:


 getmail => procmail

I use a mail filer which watches Maildir mail folders, and I have it set to 
watch several. I collect with getmail, so that phase looks like:


 getmail => "+spool"

The mail filer handles the rest, disconnected from getmail.

Any message added to that folder is filed according to my inbound email rules.  
The mailfiler also watches my "+spool-out" folder (mentioned above), and that 
is where the "save a message in multiple places" stuff happens. Its rules look 
like this:


   out,me,spool-to-phone,spool-xref . .

   "| cs-aliases-add-email sent" . .

   work,"|buglog -n -B dlog -d \"$header_date\" \"WORK: 
$shortlist_from->$shortlist_to_cc_bcc: $header_subject\""   .  
to,cc,bcc,from:(WORK1|WORK2|@workdomain1|@workdomain2|...)

That's 3 lines, in case it gets folded.

The first rule saves a copy in the folders "+out" (like Sent), "+me" (my 
primary inbox - stuff "for me", as apposed to lists etc), "+spool-to-phone" 
(also monitored, copies message to the phone mailbox), "+spool-xfer" (also 
monitored, cross reference filing).


The second pipes messages through my address learning script, adding all the 
messages to the group "sent", which is part of my whitelist of addresses that 
get to my main inbox. So if I email someone, I hope to see their replies.


The third line matches "work" email (munged for privacy) and takes a copy in my 
"work" folder (where all work related email is supposed to be should I need it) 
and also writes a log line to my logging system, which records 
from/to/subject/time.


You can see that you could easily file messages associated with your family by 
such a system, and so forth.


Cheers,
Cameron Simpson 

I must construct my own System, or be enslaved to another Man's.
   - William Blake