7 |
:Date-Created: 2002-10-28 |
:Date-Created: 2002-10-28 |
8 |
:Status: incomplete |
:Status: incomplete |
9 |
|
|
10 |
... |
Description of a concept for storing mails in Storm. |
11 |
|
|
12 |
Issues |
Issues |
13 |
------ |
------ |
14 |
|
|
15 |
* How are emails stored in a mediaserver. |
* How are emails stored in a Storm-Pool. |
16 |
|
|
17 |
|
- Separate header and body? |
18 |
|
|
19 |
- Separate header and body? - Yes: See Rationale |
RESOLVED: Yes: We store messages in Storm blocks, |
20 |
|
where we have to consider some points: |
21 |
|
|
22 |
- The way header and body of e-mails get separated. |
- The way header and body of e-mails get separated. |
23 |
|
|
24 |
|
RESOLVED: The Header is saved in one block and |
25 |
|
the body of the mail in another. |
26 |
|
|
27 |
- The same for multipart-message. |
- The same for multipart-message. |
28 |
|
|
29 |
|
RESOLVED: The individual body parts get stored in |
30 |
|
a block for each part while the headers get stored |
31 |
|
in a single block. |
32 |
|
|
33 |
- How are header-blocks and body-blocks connected. |
- How are header-blocks and body-blocks connected. |
34 |
|
|
35 |
|
RESOLVED: Introducing a new Acces-Type ``x-storm`` |
36 |
|
with a parameter block for the ID of the email body's |
37 |
|
block. |
38 |
|
|
39 |
Rationale |
Rationale |
40 |
--------- |
--------- |
41 |
|
|
44 |
Description |
Description |
45 |
----------- |
----------- |
46 |
|
|
|
We store emails in Storm blocks, where the header of |
|
|
an email is stored in one block, and the body in another. |
|
|
In the case of multipart messages, the individual body |
|
|
parts get stored in a block for each part while the |
|
|
headers get stored in a single block. |
|
|
|
|
47 |
Non-multipart messages |
Non-multipart messages |
48 |
`````````````````````` |
`````````````````````` |
49 |
|
|
56 |
``block`` which holds the ID of the block containing |
``block`` which holds the ID of the block containing |
57 |
the body. |
the body. |
58 |
|
|
59 |
The Content-Type of the block is ``message/rfc822``. |
The Content-Type of the header-block is ``message/rfc822``. |
|
Additionally the message-ID (if existent) and the |
|
|
Content-Transfer-Encoding are field of the header. |
|
|
Nothing more. |
|
60 |
After the block's header the following is inserted:: |
After the block's header the following is inserted:: |
61 |
|
|
62 |
Content-Type: message/external-body; |
Content-Type: message/external-body; |
64 |
block="<ID>" |
block="<ID>" |
65 |
|
|
66 |
where <ID> is the ID of the body's block. |
where <ID> is the ID of the body's block. |
67 |
|
Then the original mail header follows. There |
68 |
|
``Content-ID: xxx`` and ``Content-Transfer-Encoding: binary`` |
69 |
|
are added. |
70 |
|
|
71 |
|
The body-block's header has the following fields, and only these:: |
72 |
|
|
73 |
|
Content-Type: <content-type of the mail> |
74 |
|
Message-ID: <message-ID of the mail, if existent> |
75 |
|
Content-Transfer-Encoding: <...> |
76 |
|
|
77 |
|
An example: |
78 |
|
|
79 |
|
E-Mail:: |
80 |
|
|
81 |
|
From: Marc Schiereck <kanonensau@gmx.net> |
82 |
|
To: gzz developers list <gzz-dev@mail.freesoftware.fsf.org> |
83 |
|
Subject: Sample message |
84 |
|
Content-Type: text/plain |
85 |
|
|
86 |
An example:: |
Sample message. |
87 |
|
|
88 |
|
Header block:: |
89 |
|
|
90 |
Content-Type: message/rfc822 |
Content-Type: message/rfc822 |
91 |
|
|
96 |
From: Marc Schiereck <kanonensau@gmx.net> |
From: Marc Schiereck <kanonensau@gmx.net> |
97 |
To: gzz developers list <gzz-dev@mail.freesoftware.fsf.org> |
To: gzz developers list <gzz-dev@mail.freesoftware.fsf.org> |
98 |
Subject: Sample message |
Subject: Sample message |
99 |
|
Message-ID: <id@foo.org> |
100 |
|
Content-ID: storm:block:01A1F452AE2B3441AB2234B1A2378B24DFA12B3212 |
101 |
Content-Type: text/plain |
Content-Type: text/plain |
102 |
|
Content-Transfer-Encoding: binary |
103 |
|
|
104 |
|
Body Block:: |
105 |
|
|
106 |
|
Content-Type: text/plain |
107 |
|
Message-ID: <id@foo.org> |
108 |
|
|
109 |
|
Sample message. |
110 |
|
|
111 |
Multipart messages |
Multipart messages |
112 |
`````````````````` |
`````````````````` |
113 |
|
|
114 |
This works similar for multipart-messages. The message |
Storing multipart messages works similar as storing |
115 |
header stays untouched. Only the bodies of the individual |
non-multipart messages. There is one block for the |
116 |
parts get stored in mediaserver blocks (one for each |
headers and a block for each part's body. |
117 |
body) while the message header and the heades of the |
|
118 |
individual parts get saved in the same block. The |
Content-Type of the header-block is ``message/rfc822``. |
119 |
content-type of the message-parts gets changed to |
The header of the message stays untouched. Just the headers |
120 |
message/external-body and the parameters ``access-type`` |
of the individual parts are changed. They are replaced |
121 |
and ``block`` are added as in non-multipart-messages. |
by:: |
122 |
|
|
123 |
|
Content-Type: message/external-body; |
124 |
|
access-type="x-storm"; |
125 |
|
block="<block-ID>" |
126 |
|
|
127 |
|
<replaced header> |
128 |
|
Content-ID: xxx |
129 |
|
Content-Transfer-Encoding: binary |
130 |
|
|
131 |
|
where <block-ID> is the ID of the body's block. |
132 |
|
|
133 |
|
The body blocks have the same format as the body blocks |
134 |
|
of non-multipart messages. |
135 |
|
|
136 |
|
An example: |
137 |
|
|
138 |
|
E-Mail:: |
139 |
|
|
140 |
|
From: Marc Schiereck <kanonensau@gmx.net> |
141 |
|
To: gzz developers list <gzz-dev@mail.freesoftware.fsf.org> |
142 |
|
Subject: Sample message |
143 |
|
Content-type: multipart/mixed; |
144 |
|
boundary="boundary" |
145 |
|
Message-ID: <id1@foo.org> |
146 |
|
|
147 |
|
--boundary |
148 |
|
Content-Type: text/plain |
149 |
|
|
150 |
|
part1 |
151 |
|
--boundary |
152 |
|
Content-Type: text/plain |
153 |
|
|
154 |
|
part2 |
155 |
|
--boundary-- |
156 |
|
|
157 |
|
Header block:: |
158 |
|
|
159 |
An example for a multipart-header block:: |
Content-Type: message/rfc822 |
160 |
|
|
161 |
From: Marc Schiereck <kanonensau@gmx.net> |
From: Marc Schiereck <kanonensau@gmx.net> |
162 |
To: gzz developers list <gzz-dev@mail.freesoftware.fsf.org> |
To: gzz developers list <gzz-dev@mail.freesoftware.fsf.org> |
163 |
Subject: Sample message |
Subject: Sample message |
164 |
Content-type: multipart/mixed; |
Content-type: multipart/mixed; |
165 |
boundary="boundary" |
boundary="boundary" |
166 |
|
Message-ID: <id1@foo.org> |
167 |
|
|
168 |
--boundary |
--boundary |
169 |
Content-Type: message/external-body; |
Content-Type: message/external-body; |
170 |
access-type="x-storm"; |
access-type="x-storm"; |
171 |
block="<ID-part1>" |
block="<ID-part1>" |
172 |
|
|
173 |
Content-Type: ... |
Content-Type: text/plain |
174 |
|
Content-ID: storm:block:01A1F452AE2B3441AB2234B1A2378B24DFA12B3213 |
175 |
Content-Transfer-Encoding: binary |
Content-Transfer-Encoding: binary |
176 |
|
|
177 |
--boundary |
--boundary |
179 |
access-type="x-storm"; |
access-type="x-storm"; |
180 |
block="<ID-part2>" |
block="<ID-part2>" |
181 |
|
|
182 |
Content-Type: ... |
Content-Type: text/plain |
183 |
|
Content-ID: storm:block:01A1F452AE2B3441AB2234B1A2378B24DFA12B3214 |
184 |
Content-Transfer-Encoding: binary |
Content-Transfer-Encoding: binary |
185 |
|
|
186 |
--boundary-- |
--boundary-- |
187 |
|
|
188 |
|
Body block 1:: |
189 |
|
|
190 |
|
Content-Type: text/plain |
191 |
|
Message-ID: <id1@foo.org> |
192 |
|
|
193 |
|
part1 |
194 |
|
|
195 |
|
Body block 2:: |
196 |
|
|
197 |
|
Content-Type: text/plain |
198 |
|
Message-ID: <id1@foo.org> |
199 |
|
|
200 |
|
part2 |
201 |
|
|
202 |
Implementation |
Implementation |
203 |
-------------- |
-------------- |
204 |
|
|
205 |
The implementation language is Python 2.1. |
This functionality will be implemented in a |
206 |
|
Jython module, ``gzz.modules.email.converter``. |
207 |
|
|
208 |
To store a single mail the following function will |
To store a single mail the following function will |
209 |
be defined:: |
be defined:: |