![]() |
| Home > Internet > mail > |
Email Addressing FAQ (How to use user+box@host addresses) |
Section 1 of 2 - Prev - Next
Archive-name: mail/addressing
Last-modified: (2 Jun 98 14:32:39)
URL: http://www.qz.to/~eli/faqs/addressing.html
Reason-for-last-modification: exim, qmail correction, trn4 update
Reason-for-previous-modification: MMDF updated, Pine updated
If you can add information PLEASE DO. This is Unix centric because I
have answers for Unix, not because I am trying to shun other
platforms.
Questions covered
__________
1. What?
2. Why?
3. Things to consider
4. With qmail, how?
5. With sendmail, how?
6. With MMDF, how?
7. With exim, how?
8. With other MTAs, how?
9. With mutt, how?
10. With elm, how?
11. Using them in trn, how?
12. Using them in slrn, how?
13. Using them in tin, how?
14. Using them in nn, how?
15. Using them in Gnus, how?
16. Using them in knews, how?
17. Using them in MH, how?
18. Using them in pine, how?
19. Using them elsewhere, how?
20. Any other addressing suggestions?
* Appendix
1. General format of a From: header
2. Filtering
3. A word on address types
4. Comprehensive plan for a new account
5. Verifying Email Addresses
A good many of the examples in this FAQ are for a generic user, Alice,
who receives mail at bobs-home.com. Her "login" at that host is
"alice" and she uses boxes called "mail" and "news" in the localpart
of her address. (The word "localpart" comes from RFC 822 which defines
the now standard internet email address. It refers to the portion of
the email address before the "@".) Bobs-home.com uses sendmail, and
the examples reflect that.
I find this a slightly more interesting way of giving examples than
the crude "localpart@fully.qualified.domain.name" and
"localpart@hostname.tld" that earlier versions of this FAQ used.
Questions and answers:
__________
1. What?
Mail transfer agents (MTAs) usually deliver mail to a single
location for each user on the system. There are ways of having
mail sent to more than one email address being delivered to the
same user. The simplest conceptually is a mail alias. Aliases
affect the whole machine and generally can only be set up by
administrators. This is not convenient for anyone involved. So
some MTAs have special ways of creating user level aliases. To
keep these from interfering with other aspects of mail on the
machine, these addresses are the username with a piece of
punctuation and a boxname appended.
___________________
2. Why?
Traditionally it has been useful for special sorting of mail, eg
casanova+anna@love.org, casanova+beth@love.org,
casanova+cathy@love.org, etc. so that each of Anna, Beth, and
Cathy send mail to a particular address and it gets treated
specially. These days it is becoming popular as a way of providing
special filtering (such as with procmail) on email addresses
exposed to insecure channels such as Usenet.
Nancy McGough's Filtering Mail FAQ, available at the URLs below,
is a good start to finding out how to filter once you have the use
of these addresses. See also the appendix of this FAQ.
FAQ "launchers" for the Filtering Mail FAQ:
o
http://www.ii.com/internet/faqs/launchers/mail/filtering-
faq/
o http://www.best.com/~ii/faqs/archive/mail/filtering-faq/
FTP sites for the Filtering Mail FAQ:
o
ftp://rtfm.mit.edu/pub/usenet/news.answers/mail/filtering
-faq (and at the rtfm mirror sites)
o ftp://ftp.netusa.net/users/eli/mail.filtering-faq.txt
(not strongly recommended)
___________________
3. Things to consider
For these to be useful you really must have several things working
together. Some of these things require system administrator
privileges to implement, if they are not working on your system
already, some do not. Some programs are as easy to configure as
adding a line by hand to the headers shown, others require
patching the code and recompiling. Hopefully the patches will
become part of the official distributions, when needed, to prevent
too much duplication of effort.
Of primary importance, your system will need a mail transfer agent
(MTA) that can understand these addresses when there is an attempt
to give them to the system. Installing the MTA is definitely a
task for a system administrator. In some cases, configuring the
MTA will be as well.
As a secondary, but not much less important, concern you will need
to be able to configure the various user-level mail handing
programs to use these aliases. There has not been a lot of
interest in these in the past, so very few programs make it easy
to do. The interest in filtering spam sent to addresses culled
from Usenet has made configuring news posters my primary concern
for this. I would like to add Q&As for mail user agents (MUAs),
those programs that generally act as a user interface to mail, but
I do not have a strong familiarity with any myself.
As a last concern, you will want to know how to filter and sort
mail for maximum effectiveness. The appendix currently has that
information. Stephen R. van den Berg's procmail utility, available
in source form at
,
is probably the best tool around. I found it difficult to learn
without lots of well-documented examples, so I have tried to
provide examples here.
___________________
4. With qmail, how?
Qmail is an MTA.
Dave Sill told me that with qmail all
Alice has to do is "touch ~/.qmail-news" to indicate that she
wants to receive mail at . Or she can
put the name of a mailbox in the file and mail will be delivered
there. If she doesn't have the .qmail-news file mail will normally
be bounced. She can also use a .qmail-default file to catch any
other case.
If her .qmail is a single line consisting of just "#" all her mail
will silently be dropped. This might be a useful way to force
people to only send mail to her sub-boxes. She should be sure to
have files specified for her other mail, however. Since silently
discarding mail is the same as getting it and not responding (to
an outside observer), arranging to have the mail bounce might be
more useful. She could put a single line consisting of "| exit
100" there which will send a bland bounce message in the typical
qmail fashion.
This is a user level configuration; it creates boxes of the form
.
(If your site already uses '-' in usernames, you may wish to chage
the delimiter to another character. This is done at compile time.
Version 1.00, change the value of USEREXT_BREAK in conf-unusual.h.
Version 1.01, change the file "conf-break". Without this a user
called "me-too" would mask some of the suffix space for a user
called "me".)
___________________
5. With sendmail, how?
Sendmail is an MTA.
Phil Edwards talked about how to do it
with sendmail. Quoting him, because it doesn't paraphrase well,
"The usual setup is in ruleset 5, consisting of a couple lines
like
R$+ + * $#local $@ $&h $: $1
R$+ + $* $#local $@ $2 $: $1 + *
with another one or two later on in the same ruleset. (I'm doing this
from memory; it'll probably differ from your .cf.) From there,
it's up to your local delivery program." He suggests using
procmail as the local delivery program; refer to the procmail
installation instructions for (a little) more information.
This is an admin level configuration; it creates boxes of the form
. Once sendmail is configured, usage
of the mailboxes is user controlled. Recent releases of sendmail
come with this working already. (You can try to send yourself mail
at login+boxname to see if this is already set up on your system.
If not, you'll need to contact your system administrator.)
___________________
6. With MMDF, how?
MMDF is an MTA.
Jerry Sweet, maintainer of the MMDF FAQ, has provided this
detailed answer.
MMDF has long had an addressing feature of the form
"mailbox=string", which causes a message so addressed to be
delivered to "mailbox". The whole address, including the "=string"
part, appears in the $(address) variable for use in your
.maildelivery file.
An application note on how to use MMDF's "=" addressing feature to
pre-sort incoming mail is available at this URL:
http://www.irvine.com/~mmdf/auto-sort/index.html
Note that MMDF doesn't preserve the "=string" information for use
following delivery, so all handling of the $(address) information
must take place at delivery time, using the .maildelivery file. So,
in order to take advantage of MMDF's "=" addressing feature, you
must use local delivery as opposed to POP delivery. (In other
words, you need a login account on the same host that runs MMDF.)
For detailed information about using the "=" feature in one's
$HOME/.maildelivery file, refer to the MMDF maildelivery(5) on-line
man page.
This is a user level configuration; it creates boxes of the the
form .
___________________
7. With exim, how?
Exim is a MTA.
_Dom Mitchell provides this method._
First, you must find the directors section of the exim
configuration file. In it, you will find a director like this:
(it's from the default configuration file, most people should have
it)
userforward:
no_verify,
driver = forwardfile;
check_ancestor,
file = .forward,
# filter
You must then change it to look like this: (look in the exim manual
for details)
userforward:
no_verify,
suffix = "-*",
suffix_optional,
driver = forwardfile;
check_ancestor,
file = .forward,
filter
This will enable username-extension for any value of extension. But
it will still get dropped into your default mailbox. To do more
with this, you can use exim's built in filtering. You must create a
~/.forward file with the following first line:
# Exim filter
And you can then use rules like the following to save mail into
different mailboxes:
if $local_part_suffix is "-foo"
then
save $home/Mail/foo-folder
elif $local_part_suffix is "-bar"
then
pipe "/usr/local/mh/lib/rcvstore +bar"
endif
___________________
8. With other MTAs, how?
Nobody responded with smail, exim, etc solutions.
If you are using the Andrew Messaging System (AMS), which you
probably are if you have any other Andrew stuff on your system,
then you have all of this already. In fact AMS introduced the
concept. Read the documentation on FLAMES to find out how to use
this.
___________________
9. With mutt, how?
Mutt is a MUA.
To change the from header, Alice in her .muttrc defines additional
lines with the command "my_hdr":
my_hdr From: alice+mail@bobs-home.com (Alice)
To just change the Reply-to: header, she can use:
my_hdr Reply-To: alice+mail@bobs-home.com (Alice)
___________________
10. With elm, how?
Elm is a MUA.
Elm stores extra headers to be used in mail in a .elm/elmheaders
file in her home directory. She just needs to add a From: and/or
Reply-To: header in that file and it will be used automatically.
The headers should be properly formatted for mail. The appendix
has sample formats acceptable for a from line.
___________________
11. Using them in trn, how?
Trn is a newsreader.
Trn uses two environment variables, NEWSHEADER and MAILHEADER, to
control the headers that appear in posts and replies respectively.
For the default values Alice can read the man page for her copy of
trn. In the comprehensive plan for a new account there is a sample
configuration for trn. Suffice to say that she can add a from
header herself with those variables, or she can add one by hand
every time she sends mail or news. (I use a combination approach
myself.)
Note that newer versions of trn can be controlled by a user level
configuration file to do this stuff, so she doesn't need to
clutter the environment. The documentation should cover this.
At compile time it is possible to make the inews distributed with
trn4 "lax". Just define "LAX_INEWS" in config.h and recompile.
When the inews is "lax" it will check $USER and check $LOGNAME (in
that order) first for username.
___________________
12. Using them in slrn, how?
Slrn is a newsreader.
Alice can add to her .slrnrc:
username "alice-news"
With newer versions of slrn, she can set them per-group with the
article_mode_hook in the .slrn.sl file.
___________________
13. Using them in tin, how?
Tin is a newsreader.
Some versions of tin use the USER environment variable to generate
the local part of the email address. Here are two aliases
resetting it just while using tin:
csh or tcsh
alias tin "env USER=alice+news tin"
ksh, bash, or zsh
alias tin="env USER=alice+news tin"
If you already have a tin alias, it will not be used. Both aliases
will still allow you to give arguments to tin normally.
Apparently there are some versions of the "unofficial" tin
floating about that would allow her to set a "forged" address from
the menu of configuration options. These are probably not too
commonly installed.
___________________
14. Using them in nn, how?
Nn is a newsreader.
As in trn, Alice can add the from line by hand while posting or
configure nn to add them all the time. To get the latter, she
would add this to her .nn/init file:
set news-header From: Alice
She should be careful using semicolons (;) in it, unless escaped
they separate lines. The appendix has sample formats acceptable
for a from line. There is a mail-header setting for replies which
works the same way. In an over-zealous interpretation of RFC 1036,
nn will add a sender header to her posts with her un-boxed
address. I don't know any way around this. Using my inews may
work, but I have not tried.
___________________
15. Using them in Gnus, how?
Gnus is a newsreader and MUA.
To change them in news she adds to her .gnus:
(setq message-default-news-headers
"From: Alice \n")
For news and mail she can change message-default-headers instead. The
appendix describes the consideration for a From: header.
If she would also use Gnus to read and filter your mail, she can
add an entry like the following to nnmail-split-fancy:
("to" "alice\\+news"
(| ("subject" "re:.*" "misc")
("references" ".*@.*" "misc")
"spam"))
This says that all mail to this address is suspect, but if it has
a Subject that starts with a Re: or has a References header, it's
probably ok, and will be put in the "misc" group. All the rest
goes to the "spam" group. This combines filters I use with those
used by Tim Pierce.
This will sort virtually everything into the right group. She
still must check the "spam" group from time to time to check for
legitimate mail, though.
See the Info documentation for nnmail-split-fancy for details and
variations.
Mark T. Gray offers this further advice:
Also gnus rather unfortunately will insert a Sender: line if it
finds that the From: line has a different username than it thinks
it should. To correct this put the following function redefinition
in your .gnus file:
(defun message-make-sender ()
"Return the \"real\" user address.
This replaces the function in message.el which tries to ignore all
user modifications, and give as trustworthy answer as possible."
(cadr (mail-extract-address-components (message-fetch-field "from"))))
It basically will return the same name as you stuck in her From:
field above and gnus is then happy to leave out the Sender: line.
Era Eriksson points out that this behavior is a configurable
option of Gnus:
(nconc message-syntax-checks '((sender . disabled)) )
This will preserve any existing overrides for message-syntax-checks
by merely adding (sender . disabled) to the end of any preset
values. If the variable is already being set e.g. in your site-wide
initialization files, you should still be able to use this without
clobbering anything.
Another very useful function to put in her .gnus is the following
hook which will query the user for the alias to add on the
username whenever she sends a message:
(defun my-address-choice ()
"This function chooses which alias-suffix to use"
(interactive)
(let ((alias-suffix (read-string "Which alias-suffix: ")) (alias))
(setq alias
(concat user-login-name "+" alias-suffix "@bobs-home.com")
mail-default-reply-to alias
user-mail-address alias)
(message "%s" alias)))
(add-hook 'message-header-setup-hook 'my-address-choice)
One person I have corresponded with is uncertain that will work
and believes it to be of dubious value anyway. Caveat emptor. All
of this question was written with Gnus 5.x in mind. I don't know
how much will apply to earlier versions.
___________________
16. Using them in knews, how?
Knews is a newsreader.
David Kennedy says that to use these, Alice needs to put a line in
the Knews file like:
Knews.mailName: alice+news
He also offers the warning "knews = executable, Knews = config
file." David was using version 0.9.8 when he offered the advice.
___________________
17. Using them in MH, how?
Answer submitted by Philip Guenther. I had thought that MH was an
MTA/MUA, but apparently it has a news section or I am confused.
If you already have a components file for comp(1), then you just
need to add a Reply-To: or From: line to it. Be aware that if you
add a From: line then a Sender: line with your plain address will
be added by post(8), so your plain address will appear somewhere
in the message.
If you don't already have a components file then create on in your
MH mail directory (probably $HOME/Mail), that contains:
To:
Cc:
Subject:
--------
then follow the previous directions. In order for replies and
forwards to have the additional header you'll need to create or
edit replcomp and forwcomp file, and then tell repl and forw to
use them by editing your .mh_profile to include lines like:
repl: -form replcomp
forw: -from forwcomp
For the default entries for those file check the repl and forw
manpages.
___________________
18. Using them in pine, how?
Pine is a MUA and newsreader.
Pine tries to protect users from details and folly/ignorance, so
it is not easy. It requires editing the source code and
recompiling. If you feel up to it, here's how to do it.
Edit the file pine/osdep/os-xxx.h of the source where xxx is the
3-letter abbreviation for your platform. Uncomment out the section
which applies to "ALLOW_CHANGING_FROM". Compile. Run it. Go to the
pine configuration control/menu and add an entry in
"customized-hdrs" for your new From: header. The appendix has
sample formats acceptable for a from line.
Nancy McGough has a good web page on this that goes into more
detail. See it at either
or
at
.
___________________
19. Using them elsewhere, how?
Well, if Alices uses sendmail directly to send mail (as I often
do) it is pretty obvious how. Otherwise, I am not sure. Netscape
and other programs which ask her to provide her own address will
doubtlessly accept these addresses readily.
If she uses a program which has inews inject news into an NNTP
server, you might find the mini inews that I have hacked up
useful. It works like inews with programs that use it in one of
these forms:
+ inews -h < file (new inews)
+ inews < file (old inews)
+ inews -h file (new inews)
+ inews file (old inews)
Anything that counts on command line options working is going to
be disappointed. Older versions of lynx and all versions of rn,
trn and nn that I know use inews in this fashion.
This mini inews is from nn by way of lynx and has a number of
hacks and bug fixes by me. Of primary concern is that it is now
influenced by a NEWSMAILBOX environment variable when generating
the From: header. If you would like to use it, the source is kept
at ftp://ftp.netusa.net/users/eli/mini-inews.tgz in a tar/gzip
file.
Alice would use one of these two set ups with this:
A. In her .login or her shell rc file (.cshrc or .tcshrc) for
csh or tcsh she would have:
setenv NEWSMAILBOX +news
B. For sh/ksh/bash/zsh she would have this in her .profile:
NEWSMAILBOX=+news
export NEWSMAILBOX
___________________
20. Any other addressing suggestions?
RFC822 is a long and complex document for those without strong
computer science backgrounds. Parts of it will be understandable
to most who read it, parts will not. Among other things it
specifies how email addresses can be formatted. News and SMTP mail
use RFC822 addresses. If she changes her address to one that is
equivalent but written differently, she may be able to use
procmail or another filtering tool process them.
In particular the case sensitivity (upper vs. lower) of the
localpart (that which comes before the @ reading left to right) is
at the option of the destination machine. So if her MTA is (most
are) case insensitive for those addresses, she can change the case
of her name and all other mailers should preserve that
capitalization change. Humans typing the name tend not to be.
Many mailers will preserve any "comments" included in an email
address. RFC822 defines a comment:
comment = "(" *(ctext / quoted-pair / comment) ")"
ctext =
quoted-pair = "\" CHAR ; may quote any char
linear-white-space = 1*([CRLF] LWSP-char) ; semantics = SPACE
; CRLF => folding
CHAR
7-bit character
LWSP
linear whitespace: TAB and SPACE
CR
carriage return, an ASCII control character
LF
line feed, an ASCII control character
This is not very legible to the typical human. What it means is a
comment may contain any character, but some -- "(" ")" "\" CR --
must be "backslash escaped". That just means put a backslash (it
is "\" and not "/") in front of characters whose special meanings
that need to be escaped.
Mostly. There is also that bit that comments may contain other
comments; this will preclude using regular expressions to match
addresses. Basically this translates to mean that your parentheses
must match in the normal manner or else should be backslash
escaped. So some valid comments are
(hi-ya @lice here)
(This is //-\\lice)
(Let's (recurse (and (again (and (again (and (I'm (bored (now))))))))))
(\) whee)
And some invalid comments would be
(\/\/\/\/\)
()ops)
(Spiff()
Now, if that were not ugly enough, RFC822 says that there can be
whitespace or comments by any delimiter. The delimiters are
( ) < > @ , ; : \ " . [ ]
So the following are all legal and equivalent addresses for me:
< eli @ netusa . net >
< eli(Elijah)@netusa(not associated with usa.net).net >
(Elijah)
< eli @ (the raw IP for mail (and thus subject to change)) [204.141.0.25] >
< eli @ (a subtler variation on the above) [204.141.25] >
))@ (qz (pronounced (queasy) ) \
.little-neck (I did not want that, but RFC1480 required it) .ny (New \
F%@!: York) .us (USA) or ) netusa (Located on Long Island) . net> (Elijah)
Alice will find that a lot of mailers are not RFC822 compliant by
trying some of those out, especially that last one. Most mailers
seem happy to accept and preserve addresses like the second one
from the top, so that may be a good way for Alice to modify her
address for filtering purposes. "Preserve" does not mean that the
comment will be in the same place, just that it will be included.
The URL (uniform resource locator) mailto: scheme employs an
"RFC822 addr-spec" address in the scheme specific part. According
to my reading of the relevant RFCs, this means you can use
comments in mailto: addresses, but the "%", "+", and whitespace
characters should be "percent escaped". This escaping works by
having a % followed by the hexadecimal value of the character so
%
=> %25
+
=> %2b
=> %20
Note that the "<" and ">" address delimiters should not be used in
a URL. The URL format itself precludes the need for them.
Other people disagree with my reading of the RFCs on this issue.
They think comments are not allowed at all in the mailto: scheme.
And it is true that some of the more obscure web browsers
incorrectly percent escape parentheses, thus destroying the
address. I think all versions of Netscape, Explorer, Mosaic, and
Lynx get it right, but use with caution.
___________________________________
Appendix
__________
General format of a From: header
Here are the three generally accepted formats for a From: line. These
are actually just special cases of RFC 822 addresses appearing after
the string "From: ". RFC 1036 specifies that only one of these
variations should be used for news. I have tried other variations in
mail and seen weird things happen when people with combined mail and
news readers try to reply.
From: alice+news@bobs-home.com (Alice)
From: Alice
From: alice+news@bobs-home.com
localpart will be your username+box; the fully qualified domain name
is the full name of a machine you receive mail at; the name field has
whatever "full name" you want to use. See the other suggestions
question for more information on RFC 822 addresses.
__________
Filtering
Well, now that Alice has a means of marking addresses for different
handling, it is entirely reasonable that she might want some advice on
how to use the marks effectively. Nancy McGough's Filtering Mail FAQ
referenced earlier in this FAQ is a good place to start learning about
filtering tools. I am going to provide some advice here for what to
filter with. I have a filtering resource page that gives information
on the filters I use, including a link to an annotated version of my
procmailrc. The page is at
I have found it very effective to give addresses exposed to Usenet in
the form of a From: or Reply-To: line the most stringent filtering. I
use procmail to handle my filtering, and this is the exact recipe I
have for it (my Usenet posts go out from
):
:0:
* ^TOusenet-tag@qz
* !^Subject:(.Re:|(.*[[({ -](was|Re):))
IN.junk
IN.junk is a mbox file I check occasionally for false positives. Maybe
1-3% of it is false positives, often very easily distinguishable from
the other stuff by the subject line.
For those unfamilar with regular expressions (REs), that recipe is
probably not very clear. Unfortunately REs are quite complicated and
beyond the scope of this document. Jeffrey Friedl has written a good
book about them, Mastering Regular Expressions published by O'Reilly
and Associates. Many other sources cover them in less detail. Check
your documentation for grep or egrep in particular. Be aware that most
egreps today are much more sophisticated than the one procmail claims
to be compatible with.
In English, here's what that does. All mail sent to an address
containing the phrase "usenet-tag@qz" which gets delivered to me will
be tested for compliance with the second rule. The second rule says
any of that mail which does not have a subject which begins with "Re:"
or have a subject which anywhere in it contains a "[", "(", "{", " "
or "-" followed immediately by a "was:" or "Re:" is put into the junk
Section 1 of 2 - Prev - Next
| Back to category mail - Use Smart Search |
| Home - Smart Search - About the project - Feedback |
© allanswers.org | Terms of use