[Charlug] Procmail Forward to Aliases

Michael McCandless michael at prismbiz.com
Sat Jan 24 22:11:36 EST 2009


-----Original Message-----
From: C. Michael Pilato [mailto:cmpilato at red-bean.com]
Sent: Tuesday, January 20, 2009 8:25 AM
To: Michael McCandless
Cc: Leam Hall; charlug at charlug.org
Subject: Re: [Charlug] Procmail Forward to Aliases


Michael McCandless wrote:
> Leam, since I forgot the subject the first post, I added one.
> 
> When I use a .forward file, it has the same effect as an entry in
> etc/aliases - procmail is not invoked, the email is just redirected to
> kidsname at college.edu
> 
> I did look at the URL you provided, and that does not seem to do the trick.
> 
> How about this:
> if I put a .procmailrc file in the user's home directory, and then add a
> simple procmail recipe to forward email, I almost have a solution. But the
> forwarded email now has the prismbiz.com address as sender.  Can I use
> formail to 'adjust' the sender in this scenario?

File this under "Thinking Inside a Different Box".

Spamassassin in, in my experience, a resource hog and pain to train.  I use
a mail configuration like so:

   cmpilato at red-bean.com -> Gmail -> cmpilato at red-bean.com

I do this all using a .forward file on my home directory on the red-bean
server plus Gmail's setting to forward all mails elsewhere, and I can pull
it off without any mail loops.

You could do the same for your kids, and the setup would be way, way simpler
than my own:

   kiddo at prismbiz.com -> Gmail -> kiddo at college.edu
                     /        /
     aliases rule --'        /
                            /
     Gmail forwarding -----'

The benefits are three-fold:  Gmail's spam detection is (again, my
experience) way better and way easier to manage than spamassassing; not
using spamassassin on my server means a noticeable reduction in resource
consumption; Gmail archives mail forever, so you don't have to keep every
mail in your MUA.

Just a suggestion.

-- 
C. Michael Pilato <cmpilato at red-bean.com> | http://cmpilato.blogspot.com/

Michael, I really liked your suggestion and I am going to file that away for future reference. However, for now, I'm sticking with my Spamassassin setup.

When I removed aliases for the kids at college, and used a .procmailrc file in each kid's home directory, email got forwarded to kid at college.edu - but the original sender was replaced by kid at prismbiz.com.

I searched around and found the following procmail recipe which uses the original sender.

So, now I have:

person at internet.com --> kid at prismbiz.com --> local delivery/spamassasin/clamav --> send to kid at college.edu

SENDMAIL=/usr/sbin/sendmail
FROM_=`formail -c -I"Reply-To:" -rt -xTo: \
  | expand | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'`
SUBJ_=`formail -xSubject: \
       | expand | sed -e 's/^[ ]*//g' -e 's/[ ]*$//g'`

# Make a copy of all email to my second address
:0
* ! ^X-Loop: myid at myhost\.mydom
{
  :0c:${HOME}/procmail.lock
  | formail -A"X-Loop: myid at myhost.mydom" \
    -I"Subject: ${SUBJ_} [autofwd]" \
    | ${SENDMAIL} -f"${FROM_}" my2ndId at my2ndHost.mydom





More information about the CharLUG mailing list