Please enable JavaScript to view this site.

A-Shell Consolidated Reference

Navigation: Subroutines > EMAILX

EMAILX Header Specifications

Scroll Prev Top Next More

The specification for header fields is spelled out (in excruciating detail) in RFC 822, which any decent search engine can take you right to. However, if you are not interested in that level of detail, here are is a mercifully (but not very) brief overview.

The first thing to note is that from the standpoint of the STMP protocol, headers are actually part of the body or "data" of the message, and thus is it quite possible that an SMTP server would accept virtually anything, including nothing, in the way of headers at the start of your message. However, that is not to say that SMTP servers do not typically parse and possibly interpret your headers and add their own, nor that email readers do not depend on certain minimum standards for message headers.

Format wise, the main syntactic requirement is that the header section of the message consist of one or more lines with header keywords (e.g. To, From, Date, etc) followed by optional whitespace, followed by a colon, followed by more optional whitespace, followed by some kind of text, which may have further syntactic requirements depending on the header keyword.

For example, the To: field must contain validly formatted email addresses. If the data following the colon is too long to fit on one line, you may continue it by inserting a CRLF followed by at least one whitespace character followed by the continuation of your field. The whitespace at the start of the continuation line is essential to mark it as a continuation of the prior header field and not a new header field.

Header keywords (e.g. To, From, Subject, etc.) are not case sensitive. However, in order to slightly reduce the confusion between similarly named header keywords (e.g. To, From) and EMAILX parameters (e.g. TO, FROM) we will from here on reference the former using upper and lower case, followed by a colon (.e.g. To:) and the latter using upper case (e.g. TO). We highlight both in bold to make them stand out as keywords from the surrounding text.)

The end of the headers and the start of the body of the message is marked by a blank line (two CRLF’s in a row.) This may explain the need for the EMF_HDRCAT flag in opflags; it helps EMAILX decide if it should insert a blank line between your header parameter and your body parameter.

As a bare minimum, every message should have Date:, To:, and From: header fields. The normal—and universally recognized—header fields are shown in the following table.

It is also possible to have User Defined Header Fields, which see for more information.

Header

Description

Date

The SMTP server will automatically insert the Date: header field for you, so there is no need to manually include one.

To

 

From

 

Subject

A free format line describing the message. This is so common that most email readers have a space dedicated to it.

cc

A list of names this message is being copied to. To reiterate a critical point in the discussion above about the difference between the To: header and the to parameter, the cc: header field is just for aesthetics. If you want to actually send the message to the people listed, you must include them in the to parameter.

Bcc

A list of people this message is being blindly copied to. The comment above for the cc: field applies here as well, except that in practice, virtually all SMTP servers and/or email readers will interpret this field and hide the information from some or all of the recipients of the message.

Reply-To

Address to send replies to. Virtually all email readers will interpret this field and use it if you select the "reply" option within the email program.

Sender

Address of the person sending the message, as distinct from the composer of the message. For example, a secretary’s email address.

Comment

A free-format comment which is not technically part of the message body. For example, you might use this to include some explanatory remarks when a message is being forwarded, or when the message is being sent by someone other than the actual originator of the message. It might be considered analogous to a post-it note stuck to a typewritten letter.

In-Reply-To

An indication of what (and/or who) this message is in reply to.