procmail
[Top] [All Lists]

Re: newbie needs aliasing help

1997-08-29 12:46:02
At 01:43 PM 8/29/97 -0500, Kenneth J Blansette wrote:

I have been using procmail for a few months to simply alias email
addresses from my domain and forward them to individual pop accounts:

:0
^TO.*username@
! username(_at_)domain(_dot_)net

On the match line, you're missing the leading "* "  Presumably a typo when
entering it in the message, but I mention it just in case it wasn't...

The problem -- when people sign up for a mailing list "like this one for
example" the To: field doesn't contain the recipients username as I'm
sure your all aware. 

Lots of mail doesn't contain the user address in the To: field.

There are things for which Procmail is well suited, and there are things
for which it isn't.  Sendmail (newer versions at least) handles aliasing
quite well (and with even less system load).  You want to check
/etc/aliases or (if virtual hosting multiple sub/domains), possibly
/etc/virtualusers.txt.  It rather depends on the sendmail config.

How do I forward a message that has a "Mail-For:
<username(_at_)mydomain(_dot_)com>" in the header?

Easy:

:0
* ^Mail-For:(_dot_)*username(_at_)mydomain(_dot_)com
! username(_at_)domain(_dot_)net

Better yet what about headers like this list that don't have the
username in the headers at all???

Sendmail aliasing.

If you had access to the envelope-to, you could conceivably filter using
procmail on that (in exclusion of any other addressing), but as long as
I've been on this list, I still haven't ever seen a complete description of
implementing envelope-to in sendmail (which of course, isn't the topic here
anyway - but the envelope info would be handy to have for procmail
nonetheless).

Another _possible_ workaround is to look for the addressee like so:

:0
* $? formail -ISubject: -IFrom: -IReturn-Path: -IReply-To: -IComments: |
egrep -i username(_at_)mydomain(_dot_)com
! username(_at_)theirdomain(_dot_)com

Or something similar (I just knocked this out - not tested, not used by me,
and the egrep invocation is probably buggy).  This would allow you to catch
it in an Apparently-to, To:, CC:, or recieved (where blinds often show up
as ".. for address(_at_)domain ..")

:0
* ^Recieved:(_dot_)*username(_at_)mydomain(_dot_)com
! username(_at_)theirdomain(_dot_)com

Should at least allow you to catch the instances of blind carboning of the
user when they are the ONLY local addressee on the message.

Unfortunatley, Neither of these work right when two or more local users are
addressed on the same message (for example, if two users are forwarded a
joke by a common friend).  Again, sendmail is the more appropriate tool.

If you're running your own domain (and the machine it is hosted on), you
should have easy access to tweaking sendmail.  If you're being hosted by
another service (where you simply have a "virtual domain" account), then
you're probably SOL for changing the sendmail config.

---
 Please DO NOT carbon me on list replies.  I'll get my copy from the list.

 Sean B. Straw / Professional Software Engineering
 Post Box 2395 / San Rafael, CA  94912-2395

<Prev in Thread] Current Thread [Next in Thread>