Re-sending selected e-mail messages

Robert Bonomi bonomi at mail.r-bonomi.com
Thu Feb 14 05:36:11 UTC 2013


> Date: Thu, 14 Feb 2013 00:49:13 +0100
> From: Polytropon <freebsd at edvax.de>
> To: FreeBSD Questions <freebsd-questions at freebsd.org>
> Subject: Re-sending selected e-mail messages
>
> I need a way to automatically re-sent stored e-mail messages
> according to some criteria and like to ask for advice or
> suggestions for an already existing solution before I start
> reinventing the wheel. :-)
>
> The messages in question are stored in MH format. 
>
> What is the easiest way to do this without reinventing the wheel,
> or should I? :-)

procmail is your friend.

  cat ~/sent* |procmail -f resendrc

where resendrc is:

   emailaddr="foo at bar.baz"
 
   :0 
   *^To: *${emailaddr}
   *^Subject:\/.*$
   | formail -I "Subject: {resend} ${MATCH}" | $SENDMAIL -oi -t

Delete the 'formail' if you want the Subject: unmolested.




More information about the freebsd-questions mailing list