Re: [Exim] Using the textual part of email address

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Jim Knoble
Date:  
À: exim-users
Sujet: Re: [Exim] Using the textual part of email address
Circa 2002-Aug-14 13:22:37 -0700 dixit Ross Boylan:

: The RFC 822 mailbox specification permits an identifying phrase in
: addition to the "real" email address, for example
:
: Ross Boylan <xfq@???>
:
: has "Ross Boylan" (that's what I mean by the "textual part" in the
: subject; I know it's all text).
:
: I would like to use this in my exim filter. I know it's in the message
: headers, but does it ever appear anywhere else?
:
: For example, does the envelope information ever include this?
: Do exim's per address macros (e.g., $local_part) include this?

The envelope addresses and the ${local_part} and ${domain} expansion
values are RFC-2821 addresses, not the addresses in RFC-2822 message
header fields. RFC-2821 addresses do not contain any "display text"
(which is what RFC-2822 calls your "textual part").

: My impression is that the answer to both questions is "No."
:
: The reason I'm interested in this is that I have one address that
: I'm using for myself and my wife, and I'd like to pick out mail to
: her based on the identifying phrase. I am also planning on doing
: some mailing list type things, and would like to do something
: similar with them. I use a dial-up ISP.
:
: At the moment I'm using a system-wide address filter (the one that
: works on a per-address, rather than per message basis)* to identify
: things with my wife's name in the headers. This is probably
: serviceable, but can get screwed up in a number of ways. The
: underlying problem is that I don't know which of the entries in the
: message header (if any) is actually the source of the particular
: address the filter is handling, so it may focus on an irrelevant
: address. For example
:
: To: karenWhoIsNotMyWife@???
: Cc: RossBoylan@???
:
: When the cc comes back to me, the filter detects that delivery is to
: me and that a header includes the string "karen" (my wife's name).
: It concludes the message is intended for her, and sends it to her.

[...]

: I know this is all very hokey, and that in a perfect world we would
: have a fixed domain to which I could attach arbitrary local names,
: but I don't. My current ISP allows me several mailboxes, but I
: don't want to give them out as permanent contacts in case I switch
: ISPs. I also know these kind of personal uses are not exim's
: intended target. But I'm using it, so I thought I'd ask!

How are you receiving your mail now? Via POP/IMAP, or via some other
method?

If you have any measure of control over the mail server that parses
local parts for your domain, then you should use local-part prefixes or
suffixes for this.

For example, mail to <rossboylan+ross@???> would go to you, and
mail to <rossboylan+karen@???> would go to your wife. The way
that would work is that the upstream mail server interprets the '+' and
everything following it in the local-part to be a "suffix" which it can
ignore when routing the message. When your machine gets it, it
interprets everything before (and including) the '+' as a "prefix"
which can be ignored when delivering.

Exim 3.x's directors have options which handle these prefixes and
suffixes (don't confuse them with the prefix and suffix options for the
appendfile transport, which are completely different).

Alternatively, if you don't have that much control over the upstream
server (for example, your ISP is unable or unwilling to implement
local-part suffixes or prefixes), you may wish to subscribe to an
aliasing service such as pobox.com. You would set up several aliases
in the pobox.com domain---for example, <ross@???> and
<karen@???>---both of which you would configure to forward to
your mailbox at your ISP. When you receive the mail, you parse the
recipient headers (To:, CC:, Resent-To:, Resent-CC:) in the same way
you're talking about now, but this time you've got actual addresses
to key on, rather than display text. This way other folks besides
yourself can use the addresses without having to remember to set the
display text appropriately.

You may find that procmail or similar delivery agents are better suited
for distinguishing addresses in headers and acting on them.

Also if it turns out that you and karen actually get different
addresses at some point in the future, you can simply reconfigure one
or both of them to point to the new address(es).

[I don't work for pobox.com or anything, nor do i get referral bonuses.
I've just been a rather satisfied user for quite a long time (around 7
or 8 years now, i think?). And at US$15 per year, it costs less than
an American Express card.]

--
jim knoble | jmknoble@??? | http://www.pobox.com/~jmknoble/
(GnuPG fingerprint: 31C4:8AAC:F24E:A70C:4000::BBF4:289F:EAA8:1381:1491)