Platform SDK: Exchange Server

Sample Gateway Message Format

This appendix describes the format of messages in the Microsoft Exchange Server sample gateway. These messages are based on RFC 822. The message format is as follows:

Message Component Format
Message Envelope Content
Envelope TnefAttachName EnvOriginator EnvRecipients EnvDataLine
TnefAttachName “X-Tnef-Attach:” <EOL> |
“X-Tnef-Attach:” MAPIMAIL.DAT <EOL>
EnvOriginator MAIL FROM:” Address <EOL>
EnvRecipients EnvRecip | EnvRecip EnvRecipients
EnvRecip “RCPT TO:” Address <EOL>
EnvDataLine “DATA:” <EOL>
Content IPMContent | ReportContent
IPMContent ClassIPM IPMHeader IPMBody TNEFAttach |
ClassIPM IPMHeader IPMBody
ReportContent ClassReport ReportHeader ReportBody TNEFAttach |
ClassReport Report Header ReportBody
ClassIPM X-Message-Class:IPM.” SubClass<EOL>
ClassReport X-Message-Class:Report.” SubClass<EOL>
IPMHeader IPMDate IPMSource IPMDestinations IPMHumanDetails
IPMDate Date:” DateTime <EOL>
DateTime Day, <SP> Date <SP> Month <SP> Year <SP> Hours “:” Minutes “:” Seconds “UT”
IPMSource IPMID [IPMSubjectID] IPMTrace IPMFrom
IPMID “X-Message-ID:” MessageIdString <EOL>
IPMSubjectID “X-Subject-Message-ID:” MessageIdString <EOL>
IPMTraceEntries IPMTraceEntry | IPMTraceEntry IPMTraceEntries
IPMFrom “From:” Address <EOL>
IPMTraceEntry X400RcvdBy X400RcvdAt X400AttBy X400DefdAt
X400RcvdBy “X400-Received-By:” StringRepOfTraceInfo<EOL>
X400RcvdAt “X400-Received-At:” DateTime<EOL>
X400AttBy “X400-Attempted-By:” StringRepOfTraceInfo<EOL>
X400DefdAt “X400-Deferred-At:” DateTime<EOL>
StringRepOfTraceInfo /P=“ Prmd “/A=“ Admd “/C=“ Country “/” “;” Action
Action “Redirected” | “Expanded” | “Relayed” | “Rerouted”
IPMDestinations IPMDestination | IPMDestination IPMDestinations BlankLine
IPMDestination IPMDestinationPrefix Address <EOL>
IPMDestinationPrefix TO:” | “CC:” | “BCC:”
BlankLine <EOL>
<EOL> “\r\n”
IPMHumanDetails IPMHumanDetails
ImportanceVal “High” | “Normal” | “Low”
PriorityVal “Normal” | “Non-Urgent” | “Urgent”
IPMBody BodyText BodyText AttachmentText
BodyText BodyHeader BodyLines BodyFooter
BodyHeader “----beginbody:” LengthOfTextInBytes(decimal represented as ASCII)
BodyLines BodyLine BodyLines | BodyLine
BodyFooter <EOL>“----endbody”<EOL>
BodyLine RegularLineOfText
AttachmentText <NULL> |
AttachmentHeader “----beginattach:” AttachId “:” AttachLength <EOL>
AttachId BaseFileName
AttachmentTail <EOL>“----endattach”<EOL>
BaseFileName The name of the file in 8.3 format.
AttachmentLength The length of the file in bytes (decimal number represented as ASCII digits)
ReportHeader IPMDate IPMSource IPMDesination IPMHumanDetails
ReportBody NDRBodies | DRBodies | NRNBody | RNBody
NDRBodies NDRBody NDRBodies | NDRBody
NDRBody NDRNonDeliverLine NDRTextLine NDRDiagLine NDRCodeLine
NDRNonDeliverLine “Your message was not delivered to:” Address<EOL>
NDRTextLine “for the following reason:” ReportText<EOL>
NDRDiagLine “Diagnostic code:” DiagnosticCode<EOL>
NDRCodeLine “NDR code:” ReasonCode<EOL>
DRBodies DRBody DRBodies | DRBody
DRBody DRDeliverLine AtTimeLine
DRDeliverLine “Your message was successfully delivered to:” Address<EOL>
AtTimeLine “at:” DateTime<EOL>
NRNBody NRNNotReadLine AtTimeLine NRNDiscardLine NRNCodeLine
NRNNotReadLine: “Your message was not read by:” Address<EOL>
NRNDiscardLine “Discard code:” DiscardCode<EOL>
NRNCodeLine “Non-receipt code:” NonReceiptCode<EOL>
RNBody RNReadByLine AtTimeLine
RNReadByLine “Your message was read by:” Address<EOL>
TNEFAttach TNEFHeader TNEFData
TNEFHeader “MAPIMAIL.DAT:”<EOL>
TNEFData binary TNEF data

Line Formatting Rules

The tag and data portion of a line (tag:data) is printed on one line, regardless of length. A line is terminated with the carriage return/new line sequence (\r\n).

The message text data, binary attachment data, and TNEF data are handled individually. The message text is printed out exactly as it was formatted in the original message. No line breaks are added.

The binary attachment data is encoded. Each byte in the original attachment is converted to a two-character hexadecimal representation of that byte. (For example, 256 is FF.) Each two-character hexadecimal representation is separated from the next one by an ASCII space. A total of 24 hexadecimal byte pairs are printed per line.

The TNEF data is printed out directly by the TNEF encoding function. No formatting is done on the data printed out by TNEF.