summaryrefslogtreecommitdiff
path: root/addresses.5
blob: 1fd4c5ba1d21a91fd763168abd4f9a331dbedb95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
.TH addresses 5
.SH "NAME"
addresses \- formats for Internet mail addresses
.SH "INTRODUCTION"
A
.B mail address
is a string of characters containing @.

Every mail address has a
.B local part
and a
.B domain part\fR.
The domain part is everything after the final @.
The local part is everything before.

For example, the mail addresses

.EX
   God@heaven.af.mil
   @heaven.af.mil
   @at@@heaven.af.mil
.EE

all have domain part
.BR heaven.af.mil .
The local parts are
.BR God ,
empty,
and
.BR @at@ .

Some domains have owners.
It is up to the owner of
.B heaven.af.mil
to say how mail messages will be delivered to addresses with domain part
.BR heaven.af.mil .

The domain part of an address is interpreted without regard to case, so

.EX
   God@heaven.af.mil
.br
   God@HEAVEN.AF.MIL
.br
   God@Heaven.AF.Mil
.EE

all refer to the same domain.

There is one exceptional address that does not contain an @:
namely, the empty string.
The empty string cannot be used as a recipient address.
It can be used as a sender address so that
the real sender doesn't receive bounces.
.SH "QMAIL EXTENSIONS"
The
.B qmail
system allows several further types of addresses in mail envelopes.

First, an envelope recipient address without an @ is interpreted as being at
.IR envnoathost .
For example, if
.I envnoathost
is
.BR heaven.af.mil ,
the address
.B God
will be rewritten as
.BR God@heaven.af.mil .

Second, the address
.B #@[]
is used as an envelope sender address for double bounces.

Third, envelope sender addresses of the form
.I pre\fB@\fIhost\fB-@[]
are used to support variable envelope return paths (VERPs).
.B qmail-send
will rewrite 
.I pre\fB@\fIhost\fB-@[]
as
.I prerecip\fB=\fIdomain\fB@\fIhost
for deliveries to
.IR recip\fB@\fIdomain .
Bounces directly from
.B qmail-send
will come back to
.IR pre\fB@\fIhost .
.SH "CHOOSING MAIL ADDRESSES"
Here are some suggestions on choosing mail addresses for the Internet.

Do not use non-ASCII characters.
Under RFC 822 and RFC 821,
these characters cannot be used in mail headers or in SMTP commands.
In practice, they are regularly corrupted.

Do not use ASCII control characters.
NUL is regularly corrupted.
CR and LF cannot be used in some combinations
and are corrupted in all.
None of these characters are usable on business cards.

Avoid spaces and the characters

.EX
   \\"<>()[],;:
.EE

These all require quoting in mail headers and in SMTP.
Many existing mail programs do not handle quoting properly.

Do not use @ in a local part.
@ requires quoting in mail headers and in SMTP.
Many programs incorrectly look for the first @,
rather than the last @,
to find the domain part of an address.

In a local part,
do not use two consecutive dots, a dot at the beginning, or a dot at the end.
Any of these would require quoting in mail headers.

Do not use an empty local part; it cannot appear in SMTP commands.

Avoid local parts longer than 64 characters.

Be wary of uppercase letters in local parts.
Some mail programs (and users!) will incorrectly convert
.B God@heaven.af.mil
to
.BR god@heaven.af.mil .

Be wary of the following characters:

.EX
   $&!#~`'^*|{}
.EE

Some users will not know
how to feed these characters safely to their mail programs.

In domain names, stick to letters, digits, dash, and dot.
One popular DNS resolver has,
under the banner of security,
recently begun destroying domain names
that contain certain other characters,
including underscore.
Exception: A dotted-decimal IP address in brackets,
such as
.BR [127.0.0.1] ,
identifies a domain owned by whoever owns the host at that IP address,
and can be used safely.

In a domain name,
do not use two consecutive dots,
a dot at the beginning,
or a dot at the end.
This means that,
when a domain name is broken down into components separated by dots,
there are no empty components.

Always use at least one dot in a domain name.
If you own the
.B mil
domain,
don't bother using the address
.BR root@mil ;
most users will be unable to send messages to that address.
Same for the root domain.

Avoid domain names longer than 64 characters.
.SH "ENCODED ADDRESSES IN SMTP COMMANDS"
RFC 821 defines an encoding of mail addresses in SMTP.
For example, the addresses

.EX
   God@heaven.af.mil
.br
   a"quote@heaven.af.mil
.br
   The Almighty.One@heaven.af.mil
.EE

could be encoded in RCPT commands as

.EX
   RCPT TO:<God@heaven.af.mil>
.br
   RCPT TO:<a\\"quote@heaven.af.mil>
.br
   RCPT TO:<The\\ Almighty.One@heaven.af.mil>
.EE

There are several restrictions in RFC 821
on the mail addresses that can be used over SMTP.
Non-ASCII characters are prohibited.
The local part must not be empty.
The domain part must be a sequence of elements separated by dots,
where each element is either a component,
a sequence of digits preceded by #,
or a dotted-decimal IP address surrounded by brackets.
The only allowable characters in components are
letters, digits, and dashes.
Every component must (believe it or not)
have at least three characters;
the first character must be a letter;
the last character must not be a hyphen.
.SH "ENCODED ADDRESSES IN MAIL HEADERS"
RFC 822 defines an encoding of mail addresses
in certain header fields in a mail message.
For example, the addresses

.EX
   God@heaven.af.mil
.br
   a"quote@heaven.af.mil
.br
   The Almighty.One@heaven.af.mil
.EE

could be encoded in a
.B To
field as

.EX
   To: God@heaven.af.mil,
.br
	<@brl.mil:"a\\"quote"@heaven.af.mil>,
.br
	  "The Almighty".One@heaven.af.mil
.EE

or perhaps

.EX
   To: < "God"@heaven .af.mil>,
.br
     "a\\"quote" (Who?) @ heaven . af.  mil
.br
     , God<"The Almighty.One"@heaven.af.mil>
.EE

There are several restrictions on the mail addresses that can
be used in these header fields.
Non-ASCII characters are prohibited.
The domain part must be a sequence of elements separated by dots,
where each element either (1) begins with [ and ends with ]
or (2) is a nonempty string of printable ASCII characters
not including any of

.EX
   \\".<>()[],;:
.EE

and not including space.
.SH "SEE ALSO"
envelopes(5),
qmail-header(5),
qmail-inject(8),
qmail-remote(8),
qmail-smtpd(8)