What characters are allowed in an email address?

Related searches

I'm not asking about full email validation.

I just want to know what are allowed characters in user-name and server parts of email address. This may be oversimplified, maybe email adresses can take other forms, but I don't care. I'm asking about only this simple form: user-name@server (e.g. wild.wezyr@best-server-ever.com) and allowed characters in both parts.

Email address, A special character cannot appear as the first or last character in an email address or appear consecutively two or more times. The most commonly used special� Characters in the local part of an email address RFC2821 and RFC2822 state clearly that only 7bit ASCII characters are allowed in Internet mail addresses. The following list shows all the ASCII characters and explains whether they can or should be allowed in the local part of a mail address.

Watch out! There is a bunch of knowledge rot in this thread (stuff that used to be true and now isn't).

To avoid false-positive rejections of actual email addresses in the current and future world, and from anywhere in the world, you need to know at least the high-level concept of RFC 3490, "Internationalizing Domain Names in Applications (IDNA)". I know folks in US and A often aren't up on this, but it's already in widespread and rapidly increasing use around the world (mainly the non-English dominated parts).

The gist is that you can now use addresses like mason@日本.com and wildwezyr@fahrvergnügen.net. No, this isn't yet compatible with everything out there (as many have lamented above, even simple qmail-style +ident addresses are often wrongly rejected). But there is an RFC, there's a spec, it's now backed by the IETF and ICANN, and--more importantly--there's a large and growing number of implementations supporting this improvement that are currently in service.

I didn't know much about this development myself until I moved back to Japan and started seeing email addresses like hei@やる.ca and Amazon URLs like this:

http://www.amazon.co.jp/エレクトロニクス-デジタルカメラ-ポータブルオーディオ/b/ref=topnav_storetab_e?ie=UTF8&node=3210981

I know you don't want links to specs, but if you rely solely on the outdated knowledge of hackers on Internet forums, your email validator will end up rejecting email addresses that non-English-speaking users increasingly expect to work. For those users, such validation will be just as annoying as the commonplace brain-dead form that we all hate, the one that can't handle a + or a three-part domain name or whatever.

So I'm not saying it's not a hassle, but the full list of characters "allowed under some/any/none conditions" is (nearly) all characters in all languages. If you want to "accept all valid email addresses (and many invalid too)" then you have to take IDN into account, which basically makes a character-based approach useless (sorry), unless you first convert the internationalized email addresses to Punycode.

After doing that you can follow (most of) the advice above.

What are the rules for email address syntax? – Validity Help Center, Pardot complies with the RFC's 2822 standard for email address verification in form email fields and prospect and user email addresses. Addresses with� The local-part of the email address may use any of these ASCII characters: uppercase and lowercase Latin letters A to Z and a to z; digits 0 to 9; special characters !#$%&'*+-/=?^_` {|}~; dot ., provided that it is not the first or last character unless quoted, and provided also that it does not

Allowed Characters in Email Addresses, What are valid and invalid email address characters in Exchange 2010, for example can you Special characters are allowed with restrictions. The local-part of the email address may use any of these ASCII characters RFC 5322 Section 3.2.3: · Uppercase and lowercase English letters (a–z, A–Z) (ASCII: 65-90, 97-122) · Digits 0 to 9 (ASCII: 48-57)

What are valid and invalid email address characters, With the introduction of the Internationalized Domain Names, non-ASCII characters can now be used in both the local as well as the domain parts of an email address. UTF-8 characters are used to represent the non-ASCII characters such as Chinese & Japanese characters.

Google do an interesting thing with their gmail.com addresses. gmail.com addresses allow only letters (a-z), numbers, and periods(which are ignored).

e.g., pikachu@gmail.com is the same as pi.kachu@gmail.com, and both email addresses will be sent to the same mailbox. PIKACHU@gmail.com is also delivered to the same mailbox.

So to answer the question, sometimes it depends on the implementer on how much of the RFC standards they want to follow. Google's gmail.com address style is compatible with the standards. They do it that way to avoid confusion where different people would take similar email addresses e.g.

*** gmail.com accepting rules ***
d.oy.smith@gmail.com   (accepted)
d_oy_smith@gmail.com   (bounce and account can never be created)
doysmith@gmail.com     (accepted)
D.Oy'Smith@gmail.com   (bounce and account can never be created)

The wikipedia link is a good reference on what email addresses generally allow. http://en.wikipedia.org/wiki/Email_address

Most special characters such as the #,/,! and quote marks are not allowed in e-mail addresses. Dashes and underscores are allowed.

A valid email address has four parts: Recipient name @ symbol; Domain name; Top-level domain; Recipient name The recipient name represents an email mailbox that belongs to: A specific person; A mailing list; A department; A role within a company (such as sales or customer service) The recipient name may be a maximum of 64 characters long and consist of:

Email service provider (ESP) - based on RFC standards, email addresses can technically have hyphens and other special characters in the local part. However, many ESPs enforce restrictions against them. Gmail and Yahoo! are two examples of popular providers that prevent users from including hyphens in their email addresses.

In addition to the above ASCII characters, international characters above U+007F, encoded as UTF-8, are permitted by RFC 6531, though even mail systems that support SMTPUTF8 and 8BITMIME may restrict which characters to use when assigning local-parts. A local part is either a Dot-string or a Quoted-string; it cannot be a combination.

Comments
  • The + is allowed. It drives me nuts when web sites don't allow it because my email has a + in it and so many sites don't allow it.
  • I think it is important to give links to specs, as you really want to get that right, and that's where the spec comes in. If you are too lazy to read and understand the spec, then please leave checking for allowed characters in email addresses to people who care about that stuf.
  • Earlier question covering the same material: stackoverflow.com/questions/760150/. The sad thing is, even though that question is almost 8 months older than this one, the older question has much better answers. Almost all the answers below were already out of date when they were originally posted. See Wikipedia entry (and don't worry, it has relevant official references).
  • Contrary to several answers, spaces are allowed in the local part of email addresses, if quoted. "hello world"@example.com is valid.
  • @LaraRuffleColes - For Gmail, when you create an email account, it doesn't allow you to create addresses containing a "+" sign. The "+" sign ("Plus-addressing") allows anyone with a Gmail address to add a "+" sign followed by a "string" to the end of their username to create an "alternate" ("alias") email address to use for their account. Example: "example@gmail.com", "example+tag@gmail.com". A typical (and probably "Primary") use of this is to be able to create alias email addresses for your account which allow you to tag and filter incoming email messages, theoretically filtered by sender.
  • @WildWzyr, It's not that simple. Email addresses have a lot of rules for what is allowed. It's simpler to refer to the spec than to list out all of them. If you want the complete Regex, check here to get an idea of why it's not so simple: regular-expressions.info/email.html
  • there is no simple list, just because you want something simple doesn't mean it will be so. some characters can only be in certain locations and not in others. you can't have what you want all the time.
  • @WildWezyr Well, the full-stop character is allowed in the local-part. But not at the start or end. Or with another full-stop. So the answer IS NOT as simple as just a list of allowed characters, there are rules as to how those characters may be used - .ann..other.@example.com is not a valid email address, but ann.other@example.com is, even though both use the same characters.
  • Also, remember that with internationalized domain names coming in, the list of allowed characters will explode.
  • This is no longer the valid answer, due to internationalized addresses. See Mason's answer.
  • Right; behind the scenes, the domain names are still just ASCII. But, if your web app or form accepts user-entered input, then it needs to perform the same job that the web browser or mail client does when the user inputs an IDN hostname: to convert the user input into DNS-compatible form. Then validate. Otherwise, these internationalized email addresses will not pass your validation. (Converters like the one I linked to only modify the non-ASCII characters they are given, so it is safe to use them on non-internationalized email addresses (those are just returned unmodified).)