From owner-freebsd-questions@FreeBSD.ORG Thu Feb 14 05:36:11 2013 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 44246D44 for ; Thu, 14 Feb 2013 05:36:11 +0000 (UTC) (envelope-from bonomi@mail.r-bonomi.com) Received: from mail.r-bonomi.com (mx-out.r-bonomi.com [204.87.227.120]) by mx1.freebsd.org (Postfix) with ESMTP id 656D5709 for ; Thu, 14 Feb 2013 05:36:08 +0000 (UTC) Received: (from bonomi@localhost) by mail.r-bonomi.com (8.14.4/rdb1) id r1E5eWvx025045; Wed, 13 Feb 2013 23:40:32 -0600 (CST) Date: Wed, 13 Feb 2013 23:40:32 -0600 (CST) From: Robert Bonomi Message-Id: <201302140540.r1E5eWvx025045@mail.r-bonomi.com> To: freebsd@edvax.de Subject: Re: Re-sending selected e-mail messages In-Reply-To: <20130214004913.a89dc042.freebsd@edvax.de> Cc: freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Feb 2013 05:36:11 -0000 > Date: Thu, 14 Feb 2013 00:49:13 +0100 > From: Polytropon > To: FreeBSD Questions > 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.