Raw Message Format

The BounceStudio API requires that the message data (sMessageText parameter you see in most of the API's functions) you pass into it be in it's RAW format. Here's an example of what a RAW SMTP formatted message looks like:

<---- Begin Sample Email Message ---->
Date: Fri, 14 Nov 2003 14:00:01 -0500<CRLF>
Message-ID: <AauNjVuMhvq0000007c@elsewhere.com><CRLF>
From: "Mr. PostMaster" <postmaster@elsewhere.com><CRLF>
Reply-To: "My Reply Account" <postmaster_reply@elsewhere.com><CRLF>
To: "Mrs. Someone" <someone@somewhere.com><CRLF>
Subject: Failure Notice<CRLF>
Hi. This is the mail transport agent at mail.elsewhere.com.<CRLF>
I'm afraid I wasn't able to deliver your message to the <CRLF>
following addresses.  This is a permanent error; I've <CRLF>
given up. If you have questions about this notice, please<CRLF>
forward it to postmaster@elsewhere.com along with your <CRLF>
Sorry, this account has been deactivated. (#5.2.1)<CRLF>
--- Below this line is a copy of the message.<CRLF>
Return-Path: <someone@somewhere.com><CRLF>
From: "Mrs. Someone" <someone@somewhere.com><CRLF>
Reply-To: "Mrs. Someone" <someone_reply@somewhere.com><CRLF>
To: "John Smith" <john@smith.com><CRLF>
Date: Mon, 21 Aug 00 13:50:20 -0700<CRLF>
MIME-Version: 1.0<CRLF>
Message-ID: <agW2wx6Di110f7@somewhere.com><CRLF>
This is a multi-part message in MIME format.<CRLF>
<---- End Sample Email Message ---->

IMPORTANT: According to RFC 2821 and RFC 2822, the message data must contain "lines" of text terminated by a <CRLF> (hex value 0d0a) character sequence. Typically, unix/linux systems use only a <LF> character for the "end of line" terminator in a text based file. If you're reading your RAW message data directly from the file system, there's no need convert all of the LF's to CRLF's because BounceStudio API will convert them automatically. Below are excerpts from RFC 2821 and RFC 2822, describing the "line" termination character sequence requirement.

RFC 2821 - Section 2.3.7 Lines (Excerpt)

SMTP commands and ... message data, are transmitted in "lines". Lines consist of zero or more data characters terminated by the sequence ASCII character "CR" (hex value 0D) followed immediately by ASCII character "LF" (hex value 0A). This termination sequence is denoted as in this document. Conforming implementations MUST NOT recognize or generate any other character or character sequence as a line terminator...

In addition, the appearance of "bare" "CR" or "LF" characters in text (i.e., either without the other) has a long history of causing problems in mail implementations and applications that use the mail system as a tool. SMTP client implementations MUST NOT transmit these characters except when they are intended as line terminators and then MUST, as indicated above, transmit them only as a sequence.

RFC 2822 - 2.1. General Description (Excerpt)

Messages are divided into lines of characters. A line is a series of characters that is delimited with the two characters carriage-return and line-feed; that is, the carriage return (CR) character (ASCII value 13) followed immediately by the line feed (LF) character (ASCII value 10).

RFC 2822 - 4.1. Miscellaneous Obsolete Tokens (Excerpt)

Bare CR and bare LF appear in messages with two different meanings. In many cases, bare CR or bare LF are used improperly instead of CRLF to indicate line separators. In other cases, bare CR and bare LF are used simply as ASCII control characters with their traditional ASCII meanings.