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

Re: Send equal reply to messages in mailbox folder



On 12-08-2004, at 08h 51'05", Jacob Friis Larsen wrote about "Send equal reply to messages in mailbox folder"
> I have several messages in a mailbox folder who I would like to send the 
> same reply. Can that be done easily?
> 
> Thanks,
> Jacob
> 

Yes, see here a (t)csh command:

=======================
#!/bin/tcsh
foreach address (`grep '^From ' mailbox | awk '{print $2}'`)
  cat message.txt | mutt -s 'Re: your mail' $address
end
=======================

And a (ba)sh command:

=======================
#!/bin/bash
for address in `grep '^From ' mailbox | awk '{print $2}'`
do
   cat message.txt | mutt -s 'Re: your mail' $address
done
=======================


cat message.txt can be replaced by echo "text in here" if just a line.
or you can use:
 mutt -s 'subject' -a message.txt $address

Of course other solutions are possible, you can use mail instead of
mutt, etc.

If the same address is more than once and you don't want to send
multiple messages to the same person, use:

`grep '^From ' mailbox | awk '{print $2}' | uniq`

or even better:

`grep '^From ' mailbox | awk '{print $2}' | sort | uniq`



Ionel



Reply to: