Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is root@[127.1] a syntactically valid e-mail address?

Is root@[127.1] a syntactically valid e-mail address?

Why? Why not?

like image 765
knorv Avatar asked Apr 01 '11 15:04

knorv


3 Answers

You need to check RFC 5322, section 3.4.1.

This specification is a revision of Request For Comments (RFC) 2822, which itself superseded Request For Comments (RFC) 822, "Standard for the Format of ARPA Internet Text Messages", updating it to reflect current practice and incorporating incremental changes that were specified in other RFCs.

I run your email address though http://isemail.info/ that gave the following info:

The general result is: The address is only valid according to the broad definition of RFC 5322. It is otherwise invalid.

The specific diagnosis is: The domain literal is not a valid RFC 5321 address literal

Here is the relevant passage from the email RFCs:

domain-literal = [CFWS] "[" *([FWS] dtext) [FWS] "]" [CFWS]

(RFC 5322 section 3.4.1)

like image 165
MicSim Avatar answered Oct 17 '22 01:10

MicSim


It depends on whether you mean addresses in the header (RFC 5322) or envelope addresses (RFC 5321), and in the latter case, whether you include <>, everything between <> (i.e. the source route), or just Mailbox.

It's valid according to RFC 5322, but RFC 5322 allows loads of fun things like comments! and unicorns! and cake! and ponies!. It's just about possible to parse them using Perl's "regular" expressions: Mail::RFC822::Address.

It's syntactically invalid according to RFC 5321 Section 4.1.3 since the grammar only allows address literals of the form 1.2.3.4 or with a prefix of the form "standard-tag:" (e.g. [IPv6:::1]). I've assumed you meant "Mailbox", i.e. everything between <> but not including the source route.

I'd use the latter definition, since an e-mail address isn't much good if my SMTP server won't accept it. (Yes, this is a bit of a horrible definition, but I don't think the internet will move away from SMTP any time soon.)

(Additionally, there's RFC 5336 a.k.a. "UTF8SMTP". I'm not aware of anyone who uses this.)

like image 7
tc. Avatar answered Oct 17 '22 00:10

tc.


No, RFC2822 allows IP addresses to be used as domain, but you must use a valid IP address.

Your example should be root@[127.0.0.1].

like image 3
Albireo Avatar answered Oct 17 '22 02:10

Albireo