From: bkr@drdhh.hanse.de (Bjoern Kriews)
Subject: Re: NeXTmail-Format
Organization: Digital Island
Date: Thu, 15 Oct 1992 12:22:23 GMT

neuss@igd.fhg.de (Christian Neuss ) writes:
>>Gibt's eigentlich irgendwo 'ne Doku zum NeXTmail-Format ? Irgendwie erinnere
Ich habe eine. Folgt am Ende des Postings.

>und dann uuencoded wird. Ein schoenes Beispiel, wie NeXT auf bestehenden
>Standards aufbaut, anstatt irgendein proprietaeres Format zu verwenden:
>Auf diese Art ist es ueberhaupt kein Problem, einen Reader fuer 
>NeXTmail auf einer anderen Plattform zu implementieren.

Der war gut.
Wie waere es, wenn NeXT sich bei Mail mal an einem echten Standard orientieren
wuerde (MIME ==> meines Wissens in Zukunft benutzt von DEC, Sun, IBM).
Sourcen zu MIME sind frei.

Andererseits bin ich ganz froh, dass sie sich an anderer Stelle nicht dran
gehalten haben - NeXTstep.

Anyway - hier mal die NeXTmail Doku:


>From: avie@next.com (Avadis Tevanian)
>Subject: Re: NeXTMail and proprietary file formats (was: NeXTMail on a MAC)

Our Mail program does not use a proprietary format.  I encourage you to write  
mail programs for other platforms, or even other UI's for our software  
environment that can send and receive this format.  To assist you, I am  
including the specification of the format in this message.  Thanks go to Kevin  
Wells for writing this all up, we give it out to anyone that asks.  [Note that  
Kevin's version is full of fancy formatting options, but I won't post in RTF to  
reduce the potential flamage :-)].

NeXTmail Message Format

Copyright  1990 by NeXT Computer, Inc.  All Rights Reserved.

The NeXT logo is a registered trademark of NeXT Computer, Inc. in the U.S. and  
other countries.   NeXT and NeXTmail are trademarks of NeXT Computer, Inc.   
UNIX is a registered trademark of AT&T.  All other trademarks mentioned belong  
to their respective owners.

NeXTmail Message Format

This document describes the NeXTmail  multimedia transmission format for users  
and developers who want to access and create NeXTmail messages on other UNIX   
platforms, or build gateways between NeXTmail and other mail systems.  The  
procedures described here rely on utility programs found in most standard UNIX  
implementations.  This specification applies to NeXT  software releases 1.0 and  
2.0.

The NeXTmail system sends and receives both standard UNIX mail messages and  
NeXTmail multimedia messages.  When sending a message, as soon as the user  
attaches a document or formats the text with anything other than the default  
font and paragraph formats, the message is converted to the NeXTmail multimedia  
format.  This change occurs at a specific time and is indicated by a change in  
the icon on the Deliver button in the send window.  Once this change occurs, it  
cannot be undone.  When receiving messages, NeXTmail automatically interprets  
the multimedia format correctly.

Although the the NeXTmail multimedia format is straightforward and easily  
specified, NeXT expects to change this format in the future, and thus has  
chosen not to publish the specification.  The information in this document is  
subject to change without notice and must be used with the full realization  
that programs and procedures created based on this information will not  
continue to work indefinitely.




Receiving NeXTmail Format Messages

When a NeXTmail multimedia message is received, it contains a normal RFC822  
header with an additional  Next-Attachment  field, and a block of ASCII encoded  
hexadecimal digits surrounded by lines containing the words begin and end.  The  
body of the message has been put in uuencoded format to convert binary data to  
ASCII for transmission, and compressed for efficiency.  To reconstruct the  
message, three operations must be performed:  The message must be unencoded,  
uncompressed, and broken down into its component files.

To reconstruct NeXTmail messages, perform the following steps:

1.	Save the text of the message in a file called mailfilename in its own  
subdirectory.

2.	Run the command:

uudecode mailfilename

This operation produces a file called .tar.nnn.subject.attach where nnn is some  
unique number, and subject is the subject of the mail message with blanks  
replaced by underscores.  (Note that uudecode automatically ignores the mail  
header.)

3.	Run the command:

uncompress < .tar.nnn.subject.attach | tar xvf -

This operation uncompresses the message and breaks it up into its component  
files.  At a minimum, there will be one file named index.rtf, which contains  
the body of the message in Rich Text Format  (RTF).  (For information about RTF  
see the Rich Text Format specification available from Microsoft and published  
in the Supplementary Documentation manual from the NeXT Developer's Library.)   
In addition, if the message contains sound documents, pictures, or other  
documents, these objects will appear in separate files.  For more information  
on the UNIX commands specified here, see the relevant UNIX manual pages.




RTF Format

NeXT has extended the standard RTF file format to allow references to documents  
to be attached to NeXTmail messages.  Such references are of the form:

{\attachmentnnn attachmentname
}

where attachmentname is the file name of the attachment, and nnn is the  
position of the attachment within the body of the mail message (specified as  
the number of characters from the beginning of the file).  The attachment  
reference can occur anywhere in the file, but multiple attachments must be  
referenced in the order in which they appear in the message.

Following is an example of an RTF file with an embedded attachment reference:

{\rtf0\ansi{\fonttbl\f0\fswiss Helvetica;\f1\fmodern Ohlfs;\f2\fnil  
Times-Roman;}
\margl120
\margr120
{{\attachment86 attachmentname
}
\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f1\f 
s28 this is some rich text
\f0  this is some helvectica\
\
this is more helvetica\

\pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f0\b 
0\i0\ul0\fs28 \

\pard\f2\b\fs24 This is times bold
\f0\b0 .\
\
and another line of text\

}




Creating NeXTmail Format Messages

The procedure for creating NeXTmail messages on non-NeXT UNIX systems is the  
inverse of the procedure for reconstructing NeXTmail messages.

Perform the following steps to create a NeXTmail message:

1.	Create the index.rtf file containing the message body and references to  
any attached files as described above.

2.	Put the index.rtf file and all of the files to be attached to the  
message in a separate subdirectory.

3.	Run the command:

tar cvf - * | compress | uuencode .tar.nnn.subject.attach > ../subject.temp

where subject is the subject of the message with blanks replaced by  
underscores, and nnn is an arbitrary integer.  This operation produces a file  
called subject.temp, in the parent directory of the directory where the files  
to be mailed reside.  (Note that this command must be entered as a single  
line.)

4. Mail this file in a message by itself, adding a header field of the  
form:

Next-Attachment: .tar.nnn.subject.attach, bytes, 1/1, size, 0

where bytes is the length in bytes of the subject.temp file, and size is the  
integer number of 48 byte blocks (counting the last partial block as a whole  
block), multiplied by 66 characters per block.
--
Avadis Tevanian, Jr.    (Avie)
Director, System Software
NeXT, Inc.
avie@NeXT.COM



-- 
bkr@drdhh.hanse.de - Bjoern Kriews - Stormsweg 6 - D-2000 Hamburg 76 - FRG
"Advent, Advent das Holzbein brennt" - Weihnachtsbasteleien die Freude machen 


Newsgroups: de.comp.sys.next