-
Notifications
You must be signed in to change notification settings - Fork 2
Normalizing addresses
The syntax for addresses allows for a number of different ways to represent the same address. I strong recommend that you normalized all address before passing them to SES.
The following is one possible algorithm to normalize a Mailbox:
- If the Mailbox starts with
@
, then remove the@
and all characters until you find a:
. Remove the:
. - Find the last
@
. If there is no@
, then STOP. This is not a valid address. - Take the portion of the Mailbox starting with the last
@
and convert all uppercase characters to lowercase. - If the Mailbox does not start with
"
, then STOP. You have a normalized address. - If the character before the final
@
is not a"
, then STOP. This is not a valid address. - Find all
\
characters. If the character after the\
is not either a\
or a"
, then remove the\
. - If the portion between the starting
"
and the"
before the final@
consists of only letters (A
toZ
anda
toz
), digits (0
to9
), and the following characters!#$%&'*+-./=?^_`{|}~
, then remove the"
characters. You have a normalized addresses.
Original: [email protected]
Normalized: [email protected]
Original: @bob,@sam:"sally.williams"@example.NET
Normalized: [email protected]
Original: "sam:brown"@example.org
Normalized: "sam:brown"@example.org
Feel free to make edits to this wiki, especially if things are unclear or missing. By editing or contributing you agree that your changes and additions are licensed under the Creative Commons Attribution-ShareAlike 3.0 license and you also give explicit permission to Amazon Web Services LLC and/or its affiliates to use the material as they see fit, without attribution or other restriction.