A representation of an email address.
This class encapsulates functionalities to access to different
parts of an email address without dealing with its parsing.
A MailAddress is an address specified in the MAIL FROM and
RCPT TO commands in SMTP sessions. These are either passed by
an external server to the mailet-compliant SMTP server, or they
are created programmatically by the mailet-compliant server to
send to another (external) SMTP server. Mailets and matchers
use the MailAddress for the purpose of evaluating the sender
and recipient(s) of a message.
MailAddress parses an email address as defined in RFC 821
(SMTP) p. 30 and 31 where addresses are defined in BNF convention.
As the mailet API does not support the aged "SMTP-relayed mail"
addressing protocol, this leaves all addresses to be a ,
as per the spec. The MailAddress's "user" is the of
the and "host" is the of the mailbox.
This class is a good way to validate email addresses as there are
some valid addresses which would fail with a simpler approach
to parsing address. It also removes parsing burden from
mailets and matchers that might not realize the flexibility of an
SMTP address. For instance, "serge@home"@lokitech.com is a valid
SMTP address (the quoted text serge@home is the user and
lokitech.com is the host). This means all current parsing to date
is incorrect as we just find the first @ and use that to separate
user from host.
This parses an address as per the BNF specification for
from RFC 821 on page 30 and 31, section 4.1.2. COMMAND SYNTAX.
http://www.freesoft.org/CIE/RFC/821/15.htm
version: 1.0 |