Skip to content

Commit 461ccba

Browse files
authored
Update consecutive dots remarks (#12187)
1 parent 50848e2 commit 461ccba

File tree

1 file changed

+63
-79
lines changed

1 file changed

+63
-79
lines changed

xml/System.Net.Mail/MailAddress.xml

Lines changed: 63 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -51,26 +51,25 @@
5151
<remarks>
5252
<format type="text/markdown"><![CDATA[
5353
54-
## Remarks
5554
The <xref:System.Net.Mail.MailAddress> class is used by the <xref:System.Net.Mail.SmtpClient> and <xref:System.Net.Mail.MailMessage> classes to store address information for email messages.
5655
57-
A mail address is composed of a <xref:System.Net.Mail.MailAddress.User%2A> name, <xref:System.Net.Mail.MailAddress.Host%2A> name and optionally, a <xref:System.Net.Mail.MailAddress.DisplayName%2A>. The <xref:System.Net.Mail.MailAddress.DisplayName%2A> can contain non-ASCII characters if you encode them.
56+
A mail address is composed of a [user name](xref:System.Net.Mail.MailAddress.User), [host name](xref:System.Net.Mail.MailAddress.Host), and an optional [display name](xref:System.Net.Mail.MailAddress.DisplayName). <xref:System.Net.Mail.MailAddress.DisplayName> can contain non-ASCII characters if you encode them.
5857
5958
The <xref:System.Net.Mail.MailAddress> class supports the following mail address formats:
6059
61-
- A simple address format of `user@host`. If a <xref:System.Net.Mail.MailAddress.DisplayName%2A> is not set, this is the mail address format generated.
62-
- A standard quoted display name format of `"display name" <user@host>`. If a <xref:System.Net.Mail.MailAddress.DisplayName%2A> is set, this is the format generated.
60+
- A simple address format of `user@host`. If a <xref:System.Net.Mail.MailAddress.DisplayName> is not set, this is the mail address format that's generated.
61+
- A standard quoted display name format of `"display name" <user@host>`. If a <xref:System.Net.Mail.MailAddress.DisplayName> is set, this is the format that's generated.
6362
64-
- Angle brackets are added around the <xref:System.Net.Mail.MailAddress.User%2A> name and <xref:System.Net.Mail.MailAddress.Host%2A> name, if these are not included. For example, `"display name" user@host` is changed to `"display name" <user@host>`.
65-
- Quotes are added around the <xref:System.Net.Mail.MailAddress.DisplayName%2A>, if these are not included. For example, `display name <user@host>` is changed to `"display name" <user@host>`.
66-
- Unicode characters are supported in the <xref:System.Net.Mail.MailAddress.DisplayName%2A> property.
63+
- If they're not already included, angle brackets are added around the <xref:System.Net.Mail.MailAddress.User> name and <xref:System.Net.Mail.MailAddress.Host> name. For example, `"display name" user@host` is changed to `"display name" <user@host>`.
64+
- If they're not already included, quotes are added around the <xref:System.Net.Mail.MailAddress.DisplayName>. For example, `display name <user@host>` is changed to `"display name" <user@host>`.
65+
- Unicode characters are supported in the <xref:System.Net.Mail.MailAddress.DisplayName> property.
6766
6867
Within these two formats, the following elements are allowed:
6968
70-
- A <xref:System.Net.Mail.MailAddress.User%2A> name with quotes. For example, `"user name"@host`.
71-
- Consecutive and trailing dots in user names. For example, `user...name..@host`.
69+
- A <xref:System.Net.Mail.MailAddress.User> name with quotes. For example, `"user name"@host`.
7270
- Bracketed domain literals. For example, `<user@[my domain]>`.
7371
- Comments. For example, `(comment)"display name"(comment)<(comment)user(comment)@(comment)domain(comment)>(comment)`. Comments are removed before transmission.
72+
- .NET 9 and earlier ONLY: Consecutive and trailing dots in user names. For example, `user...name..@host`. (Starting in .NET 10, consecutive dots aren't allowed.)
7473
7574
A comma is used to separate elements in a list of mail addresses. As a result, a comma should not be used in unquoted display names in a list. The following mail addresses would be allowed:
7675
@@ -90,19 +89,21 @@ The following mail address would not be allowed:
9089
9190
`"John "Jr" Doe" <user@host>`
9291
93-
When the username is not quoted, all text between the start of the string (or comma) and the address are considered part of the <xref:System.Net.Mail.MailAddress.DisplayName%2A>, including comments. For example:
92+
When the username is not quoted, all text between the start of the string (or comma) and the address is considered part of the <xref:System.Net.Mail.MailAddress.DisplayName>, including comments. For example:
9493
9594
`(non comment) unquoted display (non comment) name (non comment) <user@host>`
9695
97-
Although the <xref:System.Net.Mail.MailAddress> class accepts a mail address as valid, other mail servers may not accept the mail address.
96+
Although the <xref:System.Net.Mail.MailAddress> class accepts a mail address as valid, other mail servers might not accept the mail address.
9897
9998
The <xref:System.Net.Mail.MailAddress> class does not support the following mail address formats:
10099
101100
- Mixed quoted and unquoted display names. For example, `display "name" <user@host>`.
102101
- Groups, as defined in RFC 2822 Section 3.4 published by the IETF.
103102
- The obsolete user name formats of `"user"."name"@host`, `user."name"@host` or `"user".name@host`.
103+
- .NET 10 and later versions only: Consecutive dots in the user name, for example, `[email protected]`.
104104
105105
## Examples
106+
106107
The following code example demonstrates sending an email message by using the <xref:System.Net.Mail.SmtpClient>, <xref:System.Net.Mail.MailAddress>, and <xref:System.Net.Mail.MailMessage> classes.
107108
108109
:::code language="csharp" source="~/snippets/csharp/System.Net.Mail/Attachment/Overview/mail.cs" id="Snippet10":::
@@ -167,28 +168,26 @@ The following code example demonstrates sending an email message by using the <x
167168
<remarks>
168169
<format type="text/markdown"><![CDATA[
169170
170-
## Remarks
171-
The `address` parameter can contain a display name and the associated email address if you enclose the address in angle brackets. For example:
172-
173-
`"Tom Smith <[email protected]>"`
171+
The `address` parameter can contain a display name and the associated email address if you enclose the address in angle brackets. For example:
174172
175-
White space is permitted between the display name and the angle brackets.
173+
`"Tom Smith <[email protected]>"`
176174
177-
The following table shows the property values for a <xref:System.Net.Mail.MailAddress> object constructed using the preceding example address.
178-
179-
|Property|Value|
180-
|--------------|-----------|
181-
|<xref:System.Net.Mail.MailAddress.DisplayName%2A>|`"Tom Smith"`|
182-
|<xref:System.Net.Mail.MailAddress.Host%2A>|`"contoso.com"`|
183-
|<xref:System.Net.Mail.MailAddress.User%2A>|`"tsmith"`|
184-
|<xref:System.Net.Mail.MailAddress.Address%2A>|`"[email protected]"`|
175+
White space is permitted between the display name and the angle brackets.
185176
177+
The following table shows the property values for a <xref:System.Net.Mail.MailAddress> object constructed using the preceding example address.
186178
179+
| Property | Value |
180+
| ---------------------------------------------- | ---------------------- |
181+
| <xref:System.Net.Mail.MailAddress.DisplayName> | `"Tom Smith"` |
182+
| <xref:System.Net.Mail.MailAddress.Host> | `"contoso.com"` |
183+
| <xref:System.Net.Mail.MailAddress.User> | `"tsmith"` |
184+
| <xref:System.Net.Mail.MailAddress.Address> | `"[email protected]"` |
187185
188186
## Examples
189-
The following code example uses this constructor to create a <xref:System.Net.Mail.MailAddress> object for the <xref:System.Net.Mail.MailMessage.Bcc%2A> recipient of an email message.
190187
191-
:::code language="csharp" source="~/snippets/csharp/System.Net.Mail/Attachment/Overview/mail.cs" id="Snippet9":::
188+
The following code example uses this constructor to create a <xref:System.Net.Mail.MailAddress> object for the <xref:System.Net.Mail.MailMessage.Bcc> recipient of an email message.
189+
190+
:::code language="csharp" source="~/snippets/csharp/System.Net.Mail/Attachment/Overview/mail.cs" id="Snippet9":::
192191
193192
]]></format>
194193
</remarks>
@@ -256,19 +255,17 @@ The following code example demonstrates sending an email message by using the <x
256255
<remarks>
257256
<format type="text/markdown"><![CDATA[
258257
259-
## Remarks
260-
Leading and trailing white space in the display name is preserved.
261-
262-
If `displayName` contains non-ASCII characters, the iso-8859-1 character set is used for the `displayName` encoding. Encoding non-ASCII characters is discussed in RFC 1522, which is available at [https://www.ietf.org/](https://www.ietf.org/).
263-
264-
If `address` contains a display name, and `displayName` is not `null` and is not equal to <xref:System.String.Empty?displayProperty=nameWithType>, `displayName` overrides the value specified in `address`.
258+
Leading and trailing white space in the display name is preserved.
265259
260+
If `displayName` contains non-ASCII characters, the iso-8859-1 character set is used for the `displayName` encoding. Encoding non-ASCII characters is discussed in RFC 1522, which is available at [https://www.ietf.org/](https://www.ietf.org/).
266261
262+
If `address` contains a display name, and `displayName` is not `null` and is not equal to <xref:System.String.Empty?displayProperty=nameWithType>, `displayName` overrides the value specified in `address`.
267263
268264
## Examples
269-
The following code example uses this constructor to create <xref:System.Net.Mail.MailAddress> instances for the sender and recipient of an email message.
270265
271-
:::code language="csharp" source="~/snippets/csharp/System.Net.Mail/Attachment/Overview/mail.cs" id="Snippet9":::
266+
The following code example uses this constructor to create <xref:System.Net.Mail.MailAddress> instances for the sender and recipient of an email message.
267+
268+
:::code language="csharp" source="~/snippets/csharp/System.Net.Mail/Attachment/Overview/mail.cs" id="Snippet9":::
272269
273270
]]></format>
274271
</remarks>
@@ -336,22 +333,20 @@ The following code example demonstrates sending an email message by using the <x
336333
<remarks>
337334
<format type="text/markdown"><![CDATA[
338335
339-
## Remarks
340-
Leading and trailing white space in the display name is preserved.
336+
Leading and trailing white space in the display name is preserved.
341337
342-
If `address` contains a display name, and `displayName` is not `null` and is not equal to <xref:System.String.Empty?displayProperty=nameWithType>, `displayName` overrides the value specified in `address`.
343-
344-
The <xref:System.Net.Mail.MailAddress.%23ctor%2A> method does not check if the `displayName` parameter is valid. This method removes surrounding quotes not displayed by the <xref:System.Net.Mail.MailAddress.DisplayName%2A> property. Quotes will be added before transmission, except where <xref:System.Text.Encoding.ASCII%2A> or <xref:System.Text.Encoding.Unicode%2A> is specified in the `displayNameEncoding` parameter. The encoding specified in the `displayNameEncoding` parameter will be applied to the <xref:System.Net.Mail.MailAddress.DisplayName%2A> property before transmission <xref:System.Text.Encoding.ASCII%2A> or <xref:System.Text.Encoding.Unicode%2A> is specified in the `displayNameEncoding` parameter. <xref:System.Text.Encoding.UTF8%2A> is the default encoding if none is specified.
345-
346-
For more information on supported mail address formats, see <xref:System.Net.Mail.MailAddress>.
338+
If `address` contains a display name, and `displayName` is not `null` and is not equal to <xref:System.String.Empty?displayProperty=nameWithType>, `displayName` overrides the value specified in `address`.
347339
340+
The <xref:System.Net.Mail.MailAddress.%23ctor(System.String,System.String,System.Text.Encoding)> constructor does not check if the `displayName` parameter is valid. This method removes surrounding quotes not displayed by the <xref:System.Net.Mail.MailAddress.DisplayName> property. Quotes will be added before transmission, except where <xref:System.Text.Encoding.ASCII> or <xref:System.Text.Encoding.Unicode> is specified in the `displayNameEncoding` parameter. The encoding specified in the `displayNameEncoding` parameter will be applied to the <xref:System.Net.Mail.MailAddress.DisplayName> property before transmission <xref:System.Text.Encoding.ASCII> or <xref:System.Text.Encoding.Unicode> is specified in the `displayNameEncoding` parameter. <xref:System.Text.Encoding.UTF8> is the default encoding if none is specified.
348341
342+
For more information on supported mail address formats, see <xref:System.Net.Mail.MailAddress>.
349343
350344
## Examples
351-
The following code example uses this constructor to create <xref:System.Net.Mail.MailAddress> instances for the sender of an email message.
352345
353-
:::code language="csharp" source="~/snippets/csharp/System.Net.Mail/MailAddress/.ctor/mailasync.cs" id="Snippet2":::
354-
:::code language="vb" source="~/snippets/visualbasic/System.Net.Mail/MailAddress/.ctor/mailasync.vb" id="Snippet2":::
346+
The following code example uses this constructor to create <xref:System.Net.Mail.MailAddress> instances for the sender of an email message.
347+
348+
:::code language="csharp" source="~/snippets/csharp/System.Net.Mail/MailAddress/.ctor/mailasync.cs" id="Snippet2":::
349+
:::code language="vb" source="~/snippets/visualbasic/System.Net.Mail/MailAddress/.ctor/mailasync.vb" id="Snippet2":::
355350
356351
]]></format>
357352
</remarks>
@@ -415,15 +410,13 @@ The following code example demonstrates sending an email message by using the <x
415410
<remarks>
416411
<format type="text/markdown"><![CDATA[
417412
418-
## Remarks
419-
The value returned by this property does not include the <xref:System.Net.Mail.MailAddress.DisplayName%2A> information.
420-
421-
413+
The value returned by this property does not include the <xref:System.Net.Mail.MailAddress.DisplayName> information.
422414
423415
## Examples
424-
The following code example displays the address for an email message recipient.
425416
426-
:::code language="csharp" source="~/snippets/csharp/System.Net.Mail/Attachment/Overview/mail.cs" id="Snippet10":::
417+
The following code example displays the address for an email message recipient.
418+
419+
:::code language="csharp" source="~/snippets/csharp/System.Net.Mail/Attachment/Overview/mail.cs" id="Snippet10":::
427420
428421
]]></format>
429422
</remarks>
@@ -475,17 +468,15 @@ The following code example demonstrates sending an email message by using the <x
475468
<remarks>
476469
<format type="text/markdown"><![CDATA[
477470
478-
## Remarks
479-
Display names that contain non-ASCII characters are returned in human-readable form. Use the <xref:System.Net.Mail.MailAddress.ToString%2A> method to get the encoded form of the <xref:System.Net.Mail.MailAddress.DisplayName%2A>.
480-
481-
Some software programs that are used to read email display the <xref:System.Net.Mail.MailAddress.DisplayName%2A> property value instead of, or in addition to, the email address.
482-
471+
Display names that contain non-ASCII characters are returned in human-readable form. Use the <xref:System.Net.Mail.MailAddress.ToString> method to get the encoded form of the <xref:System.Net.Mail.MailAddress.DisplayName>.
483472
473+
Some software programs that are used to read email display the <xref:System.Net.Mail.MailAddress.DisplayName> property value instead of, or in addition to, the email address.
484474
485475
## Examples
486-
The following code example displays the <xref:System.Net.Mail.MailAddress.DisplayName%2A> for the recipient of an email message.
487476
488-
:::code language="csharp" source="~/snippets/csharp/System.Net.Mail/Attachment/Overview/mail.cs" id="Snippet9":::
477+
The following code example displays the <xref:System.Net.Mail.MailAddress.DisplayName> for the recipient of an email message.
478+
479+
:::code language="csharp" source="~/snippets/csharp/System.Net.Mail/Attachment/Overview/mail.cs" id="Snippet9":::
489480
490481
]]></format>
491482
</remarks>
@@ -585,8 +576,7 @@ The following code example demonstrates sending an email message by using the <x
585576
<remarks>
586577
<format type="text/markdown"><![CDATA[
587578
588-
## Remarks
589-
The <xref:System.Net.Mail.MailAddress.GetHashCode%2A> method returns a hash code of the mail address. This value can be used as a key in hash tables.
579+
The <xref:System.Net.Mail.MailAddress.GetHashCode> method returns a hash code of the mail address. This value can be used as a key in hash tables.
590580
591581
]]></format>
592582
</remarks>
@@ -638,15 +628,13 @@ The following code example demonstrates sending an email message by using the <x
638628
<remarks>
639629
<format type="text/markdown"><![CDATA[
640630
641-
## Remarks
642-
In a typical email address, the host string includes all information following the "`@`" sign. For example, in `"[email protected]"`, the host is `"contoso.com"`.
643-
644-
631+
In a typical email address, the host string includes all information following the "`@`" sign. For example, in `"[email protected]"`, the host is `"contoso.com"`.
645632
646633
## Examples
647-
The following code example displays the destination of an email message.
648634
649-
:::code language="csharp" source="~/snippets/csharp/System.Net.Mail/Attachment/Overview/mail.cs" id="Snippet4":::
635+
The following code example displays the destination of an email message.
636+
637+
:::code language="csharp" source="~/snippets/csharp/System.Net.Mail/Attachment/Overview/mail.cs" id="Snippet4":::
650638
651639
]]></format>
652640
</remarks>
@@ -693,19 +681,17 @@ The following code example demonstrates sending an email message by using the <x
693681
<remarks>
694682
<format type="text/markdown"><![CDATA[
695683
696-
## Remarks
697-
The string returned by this method is not necessarily identical to the string specified when the instance was created. If the <xref:System.Net.Mail.MailAddress.DisplayName%2A> property is not `null` and not equal to <xref:System.String.Empty?displayProperty=nameWithType> (""), <xref:System.Net.Mail.MailAddress.ToString%2A> returns a string composed using the following syntax:
698-
699-
<xref:System.Net.Mail.MailAddress.DisplayName%2A> \<<xref:System.Net.Mail.MailAddress.User%2A>@<xref:System.Net.Mail.MailAddress.Host%2A>>
700-
701-
If <xref:System.Net.Mail.MailAddress.DisplayName%2A> is `null` or is equal to <xref:System.String.Empty?displayProperty=nameWithType>, <xref:System.Net.Mail.MailAddress.ToString%2A> returns the value of the <xref:System.Net.Mail.MailAddress.Address%2A> property.
684+
The string returned by this method is not necessarily identical to the string specified when the instance was created. If the <xref:System.Net.Mail.MailAddress.DisplayName> property is not `null` and not equal to <xref:System.String.Empty?displayProperty=nameWithType> (""), <xref:System.Net.Mail.MailAddress.ToString> returns a string composed using the following syntax:
702685
686+
<xref:System.Net.Mail.MailAddress.DisplayName> \<<xref:System.Net.Mail.MailAddress.User>@<xref:System.Net.Mail.MailAddress.Host>>
703687
688+
If <xref:System.Net.Mail.MailAddress.DisplayName> is `null` or is equal to <xref:System.String.Empty?displayProperty=nameWithType>, <xref:System.Net.Mail.MailAddress.ToString> returns the value of the <xref:System.Net.Mail.MailAddress.Address> property.
704689
705690
## Examples
706-
The following code example displays the destination of an email message.
707691
708-
:::code language="csharp" source="~/snippets/csharp/System.Net.Mail/Attachment/Overview/mail.cs" id="Snippet7":::
692+
The following code example displays the destination of an email message.
693+
694+
:::code language="csharp" source="~/snippets/csharp/System.Net.Mail/Attachment/Overview/mail.cs" id="Snippet7":::
709695
710696
]]></format>
711697
</remarks>
@@ -916,15 +902,13 @@ The following code example demonstrates sending an email message by using the <x
916902
<remarks>
917903
<format type="text/markdown"><![CDATA[
918904
919-
## Remarks
920-
In a typical email address, the user string includes all information preceding the "`@`" sign. For example, in `"[email protected]"`, the user is `"tsmith"`.
921-
922-
905+
In a typical email address, the user string includes all information preceding the "`@`" sign. For example, in `"[email protected]"`, the user is `"tsmith"`.
923906
924907
## Examples
925-
The following code example displays the destination of an email message.
926908
927-
:::code language="csharp" source="~/snippets/csharp/System.Net.Mail/Attachment/Overview/mail.cs" id="Snippet4":::
909+
The following code example displays the destination of an email message.
910+
911+
:::code language="csharp" source="~/snippets/csharp/System.Net.Mail/Attachment/Overview/mail.cs" id="Snippet4":::
928912
929913
]]></format>
930914
</remarks>

0 commit comments

Comments
 (0)