Email RFC Naming Conventions

These email RFC naming convetions come from RFC 5322 Internet Message Format and RFC 5321 Simple Mail Tranfer Protocol.
Email Message
The entire email. To see the entire email in Gmail, view an email then click the dropdown menu on the far right, and choose "View Original".
Email Header
The entire header block, which is everything up to a blank line.
Email Header Field
For example the subject header field may be "Subject: Hello World". A header field may span multiple lines. For our programming, we call this the Email Header Field Text.
Email Header Field Name
For example the subject header field name is "Subject"
Email Header Field Body
For example the subject header field body is "Hello World"
Email Address
A string like "john@example.com". The format of email addresses is defined in RFC 5322 (mostly section 3.4.1) and RFC 5321. Notably the email address can be up to 320 characters long, and can contain some special characters like the "+" plus sign for single account filtering.
Email Address Display Name
An optional string to display in front of an email address. For example the "To" header field may be "To: John Doe <john@example.com>" shows the diplay name "John Doe" then the email address "john@example.com" in angle brackets.
Email Body
The entire email body block, i.e. everything after the first blank line.

Example Email Header Field

Naming Conventions for Developers

We like to use highly descriptive naming conventions that match the email RFC.

Java:

  email
  emailMessage
  emailHeader
  emailHeaderField   
  emailHeaderFieldName
  emailHeaderFieldBody
  emailHeaderFieldText
  emailAddress
  emailAddressDisplayName
  emailBody

Ruby, Python, Perl:

  email
  email_message
  email_header
  email_header_field   
  email_header_field_name
  email_header_field_body
  email_header_field_text
  email_address
  email_address_display_name
  email_body

Cascading Style Sheet:

  .email
  .email-message
  .email-header
  .email-header-field   
  .email-header-field-name
  .email-header-field-body
  .email-header-field-text
  .email-address
  .email-address-display-name
  .email-body 



What's Next?

blog comments powered by Disqus