Syntax Rules of RFC 822 for Internet E-mail Addresses

Author

Reads 584

Close-up of a computer screen displaying colorful programming code with depth of field.
Credit: pexels.com, Close-up of a computer screen displaying colorful programming code with depth of field.

RFC 822 defines the syntax rules for internet e-mail addresses, which are used to identify the sender and recipient of an email message.

The syntax rules for internet e-mail addresses are quite specific, with a clear distinction between local parts and domain names. The local part is the part of the email address before the '@' symbol, and it can contain letters, numbers, and special characters.

A local part can be up to 64 characters long, but it's usually shorter to avoid issues with email clients and servers.

Domain names, on the other hand, are the part of the email address after the '@' symbol, and they must follow a specific set of rules to be considered valid.

For your interest: Rfc for Email Addresses

Field Structure

The structure of header fields in RFC 822 is quite straightforward. Each header field is composed of a field name and a field body, separated by a colon.

The field name must be made up of printable ASCII characters, excluding colons. The field body, on the other hand, can contain any ASCII characters except CR or LF.

Here are the types of lexical symbols that can be found in header field bodies: Individual special charactersQuoted-stringsDomain-literalsCommentsAtoms

These symbols are the building blocks of header field bodies, and understanding their structure is crucial for interpreting the bodies of header fields.

Structure of Fields

Person using a laptop to read an email indoors beside a potted plant.
Credit: pexels.com, Person using a laptop to read an email indoors beside a potted plant.

The structure of fields is a crucial aspect of understanding how header fields are composed. Each header field is a single line of ASCII characters.

A header field is made up of a field name and a field body, which are separated by a colon (:). This is a fundamental concept in understanding how header fields are structured.

The field body can be composed of any ASCII characters except CR or LF. This is important to note, as it affects how we interpret and process the data contained within the field body.

The field body can be wrapped into a multiple-line representation, which is referred to as "folding" in RFC 822. This allows for more efficient use of space in header fields.

The general rule for wrapping field bodies is that wherever there is linear-white-space, a CR/LF immediately followed by at least one LWSP-character can be inserted. This is a key concept in understanding how header fields are structured.

A vintage windmill stands above freshly plowed fields in Kruisem, Belgium, under a clear sky.
Credit: pexels.com, A vintage windmill stands above freshly plowed fields in Kruisem, Belgium, under a clear sky.

The name of a header field must be composed of printable ASCII characters, which are characters with ASCII values between decimal 33 and 126, except colons. This is a critical aspect of header field structure.

The structure of header field bodies is more complex, and can be composed of individual special characters, quoted-strings, domain-literals, comments, and atoms. These elements are used to interpret the bodies of header fields.

Here are the basic elements of header field bodies:

  • Individual special characters
  • Quoted-strings
  • Domain-literals
  • Comments
  • Atoms

These elements are used to support the usage rules for the structure of header fields.

Domain

A domain is a sequence of one or more words separated with full stops, such as foo.bar.zap.example or cc.hut.fi.

The top-level domain is on the right and must be registered in a centralized manner and publicly.

Domain names can reflect some administrative hierarchy, like cs.hut.fi, which is the domain of the Computer Science laboratory of the Helsinki University of Technology.

Domain names might refer to a particular computer, but they don't have to.

Content-Type Defaults

A close-up view of a smartphone screen displaying the email inbox, held by an adult's hand.
Credit: pexels.com, A close-up view of a smartphone screen displaying the email inbox, held by an adult's hand.

Content-Type Defaults are a crucial part of email field structure, and it's essential to understand how they work.

A default Content-Type is assumed to be plain text in the US-ASCII character set if no Content-Type header field is specified.

If a MIME-Version header field is present, but no Content-Type header field is specified, a receiving User Agent can still assume plain US-ASCII text was the sender's intent.

In the absence of a MIME-Version header field or the presence of a syntactically invalid Content-Type header field, plain US-ASCII text may still be assumed, but the sender's intent might have been otherwise.

It's always better to specify a Content-Type header field explicitly to avoid any confusion or misinterpretation of the email content.

Address Syntax

An address in RFC 822 is a mailbox or a simple address, though it could also be a group specification, albeit rarely used.

The word "mailbox" is often used outside of RFC 822 to refer to a file where a system's E-mail software appends incoming E-mail.

A mailbox in RFC 822 identifies a recipient, not a store or a set of messages.

The semicolon (;) is used to open an explanatory statement in definitions, which is not part of the formal definition.

Check this out: Rfc 2822

Field Definitions

Credit: youtube.com, Is Internet Message Format (RFC 5322) obsolete syntax (RFC 822) still used by any email providers?

In RFC 822, header field names are composed of printable ASCII characters, excluding colons. This means that header field names can only contain characters with ASCII values between decimal 33 and 126, excluding colons.

The structure of header field bodies is more complex, and can include individual special characters, quoted-strings, domain-literals, comments, and atoms. These elements are supported by an example in the RFC 822 specification.

According to the RFC 822 specification, header field bodies can be composed of any ASCII characters except CR or LF. This means that CR and LF characters are removed when the field is unfolded, but can still be present in the actual text.

Local Part

The local part of an email address is what comes before the "@" symbol. It's a sequence of one or more words separated by full stops (dots, periods).

Some email systems don't understand local parts with multiple periods, like "P. D. Q. Bach", but others do.

Bright yellow sticky note with holiday email marketing message clipped to a wireframe wall.
Credit: pexels.com, Bright yellow sticky note with holiday email marketing message clipped to a wireframe wall.

The local part is treated as a single unit, even if it contains periods, unless it's enclosed in quotation marks.

In some domains, local parts with periods are used in a specific way, such as the firstname.lastname structure.

However, the recipient system can choose to interpret or modify the local part as it sees fit.

According to an official amendment to RFC 822, a host forwarding a message must not interpret or modify the local part of the address.

About Fields

A header field is a single line of ASCII characters, composed of a field name and a field body, terminated by a CR/LF.

The field name must be composed of printable ASCII characters, specifically between decimal 33 and 126, excluding colons. This means no fancy characters or special symbols.

The field body, on the other hand, can contain any ASCII characters except CR or LF. This allows for a wide range of text and data to be included in the field body.

Hand Holding Smartphone with Internet Access to YouTube
Credit: pexels.com, Hand Holding Smartphone with Internet Access to YouTube

Certain header field bodies, such as those for dates and addresses, have internal structure. Others, like "Subject" and "Comments", are simply strings of text.

In terms of structure, header fields can be viewed as composed of a field name, followed by a colon, followed by a field body, and terminated by a CR/LF.

The structure of header field bodies is further broken down into lexical symbols, including individual special characters, quoted-strings, domain-literals, comments, and atoms.

Here's a brief rundown of these lexical symbols:

  • Individual special characters
  • Quoted-strings
  • Domain-literals
  • Comments
  • Atoms

These symbols are used to define the structure of header field bodies, and are supported by an example in the relevant section.

In terms of syntax, header field names and bodies are defined in the Augmented BNF notation of RFC 822. This notation is used to formally define the syntax of header fields, and is essential for implementors to understand.

The syntax of header fields is also influenced by the usage rules for the elements and structure of header fields, which are supported by an example in the relevant section.

Content-Type Field

Credit: youtube.com, September Update Episode 3 RFC822 SMTP MIME

The Content-Type field is a crucial part of the syntax rules of RFC 822. It's used to indicate the type of content being sent in a message.

The syntax of the Content-Type field is defined in the Augmented BNF notation of RFC 822, which means it's a specific set of rules for how the field should be formatted. For example, a Content-Type header field value is defined as follows: `type "/" subtype` `[parameter]`.

A subtype specification is mandatory, meaning it can't be omitted from a Content-Type header field. This is because there are no default subtypes, so you need to specify what type of content you're sending.

The type, subtype, and parameter names are not case sensitive, which means they can be written in any combination of uppercase and lowercase letters. However, parameter values are normally case sensitive, but sometimes are interpreted in a case-insensitive fashion.

The value of a quoted string parameter does not include the quotes, which are used to delimit the parameter value. This means that if you see a quoted string in a Content-Type field, you should ignore the quotes and focus on the value inside.

Here's a quick rundown of the acceptable mechanisms for defining new media subtypes:

  1. Private values (starting with "X-") may be defined bilaterally between two cooperating agents without outside registration or standardization.
  2. New standard values should be registered with IANA as described in RFC 2048.

Content Transfer Encodings

A woman types on a laptop using a messaging app in a modern office setting.
Credit: pexels.com, A woman types on a laptop using a messaging app in a modern office setting.

Content Transfer Encodings are a crucial aspect of RFC 822 syntax rules. The Content-Transfer-Encoding field's value is a single token specifying the type of encoding.

These values are not case sensitive, so you can use Base64, BASE64, or bAsE64 and they're all equivalent. An encoding type of 7BIT requires that the body is already in a 7bit mail-ready representation, which is the default value.

If the Content-Transfer-Encoding header field is not present, it's assumed to be "Content-Transfer-Encoding: 7BIT". This means you don't need to specify it if your data is already in 7bit mail-ready representation.

The quoted-printable and base64 encodings are designed to be convertible between them. However, there's an issue with handling hard line breaks in quoted-printable encoding output.

Line and Character Rules

Lines are defined as sequences of octets separated by a CRLF sequence, consistent with both RFC 821 and RFC 822.

A CRLF sequence consists of the two US-ASCII characters CR (decimal value 13) and LF (decimal value 10) in that order, denoting a line break in RFC 822 mail.

Credit: youtube.com, RFC5322 (Internet message format) ABNF rule error? (2 Solutions!!)

Lines may not always correspond to what's displayed by a user agent, as they are simply a unit of data in a message.

The term CRLF is used throughout this set of documents to refer to the sequence of octets corresponding to CR and LF.

In the context of header fields, linear-white-space (LWSP) characters can be used to wrap the field-body into a multiple-line representation.

Wherever there is linear-white-space, a CR/LF immediately followed by at least one LWSP-character can be inserted instead, allowing for word-wrap.

This process is referred to as "folding", and the opposite process of moving from a multiple-line representation to a single-line representation is called "unfolding."

Encoding and Translation

The Content-Transfer-Encoding field's value is a single token specifying the type of encoding, as enumerated below.

These values are not case sensitive, so Base64, BASE64, and bAsE64 are all equivalent.

An encoding type of 7BIT requires that the body is already in a 7bit mail-ready representation, which is the default value.

Credit: youtube.com, Security: Security impact of Mail attachment type message/rfc822

The quoted-printable and base64 encodings are designed so that conversion between them is possible.

Conversion from quoted-printable to base64 involves converting a hard line break in the quoted-printable form to a corresponding encoded CRLF in the base64 form of the data.

Converting text data from base64 to quoted-printable requires converting a CRLF sequence in the canonical form of the data to a quoted-printable hard line break.

Frequently Asked Questions

What is the format for RFC 822 date?

RFC 822 dates follow a specific format: three-letter day, two-digit date, three-letter month, and time in EST, separated by commas and spaces. For example: Wed, 02 Oct 2002 08:00:00 EST

Jennie Bechtelar

Senior Writer

Jennie Bechtelar is a seasoned writer with a passion for crafting informative and engaging content. With a keen eye for detail and a knack for distilling complex concepts into accessible language, Jennie has established herself as a go-to expert in the fields of important and industry-specific topics. Her writing portfolio showcases a depth of knowledge and expertise in standards and best practices, with a focus on helping readers navigate the intricacies of their chosen fields.

Love What You Read? Stay Updated!

Join our community for insights, tips, and more.