Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 Feb 2013 23:40:32 -0600 (CST)
From:      Robert Bonomi <bonomi@mail.r-bonomi.com>
To:        freebsd@edvax.de
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Re-sending selected e-mail messages
Message-ID:  <201302140540.r1E5eWvx025045@mail.r-bonomi.com>
In-Reply-To: <20130214004913.a89dc042.freebsd@edvax.de>

next in thread | previous in thread | raw e-mail | index | archive | help

> Date: Thu, 14 Feb 2013 00:49:13 +0100
> From: Polytropon <freebsd@edvax.de>
> To: FreeBSD Questions <freebsd-questions@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@bar.baz"
 
   :0 
   *^To: *${emailaddr}
   *^Subject:\/.*$
   | formail -I "Subject: {resend} ${MATCH}" | $SENDMAIL -oi -t

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





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201302140540.r1E5eWvx025045>