Email: Message Format

Let's study the exact format of an email message!

Introduction

Email messages have a format the same way that HTTP request and response messages do. Let’s dive right into it.

Header Lines

Email messages start with header lines, much akin to HTTP. The header lines contain important metadata about the email.

  • The header lines consist of keywords followed by a colon, followed by a value.
  • Every header line is separated by a new line with a carriage return (\r).
  • Every header must have the To: and From: header lines.
  • The rest of the headers, including the subject: header line, are optional.

Message Body

The message body of the email follows the header lines after a blank line.

Here is an example of what an email message looks like:

Get hands-on with 1200+ tech skills courses.