Re-sending selected e-mail messages

Robert Bonomi bonomi at
Thu Feb 14 05:36:11 UTC 2013

> Date: Thu, 14 Feb 2013 00:49:13 +0100
> From: Polytropon <freebsd at>
> To: FreeBSD Questions <freebsd-questions at>
> 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"
   *^To: *${emailaddr}
   | 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