rmail 0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/NEWS +309 -0
- data/NOTES +14 -0
- data/README +83 -0
- data/THANKS +25 -0
- data/TODO +112 -0
- data/guide/Intro.txt +122 -0
- data/guide/MIME.txt +6 -0
- data/guide/TableOfContents.txt +13 -0
- data/install.rb +1023 -0
- data/lib/rmail.rb +50 -0
- data/lib/rmail/address.rb +829 -0
- data/lib/rmail/header.rb +987 -0
- data/lib/rmail/mailbox.rb +62 -0
- data/lib/rmail/mailbox/mboxreader.rb +182 -0
- data/lib/rmail/message.rb +201 -0
- data/lib/rmail/parser.rb +412 -0
- data/lib/rmail/parser/multipart.rb +217 -0
- data/lib/rmail/parser/pushbackreader.rb +173 -0
- data/lib/rmail/serialize.rb +190 -0
- data/lib/rmail/utils.rb +59 -0
- data/rmail.gemspec +17 -0
- data/tests/addrgrammar.txt +113 -0
- data/tests/data/mbox.odd +4 -0
- data/tests/data/mbox.simple +8 -0
- data/tests/data/multipart/data.1 +5 -0
- data/tests/data/multipart/data.10 +1 -0
- data/tests/data/multipart/data.11 +9 -0
- data/tests/data/multipart/data.12 +9 -0
- data/tests/data/multipart/data.13 +3 -0
- data/tests/data/multipart/data.14 +3 -0
- data/tests/data/multipart/data.15 +3 -0
- data/tests/data/multipart/data.16 +3 -0
- data/tests/data/multipart/data.17 +0 -0
- data/tests/data/multipart/data.2 +5 -0
- data/tests/data/multipart/data.3 +2 -0
- data/tests/data/multipart/data.4 +3 -0
- data/tests/data/multipart/data.5 +1 -0
- data/tests/data/multipart/data.6 +2 -0
- data/tests/data/multipart/data.7 +3 -0
- data/tests/data/multipart/data.8 +5 -0
- data/tests/data/multipart/data.9 +4 -0
- data/tests/data/parser.badmime1 +4 -0
- data/tests/data/parser.badmime2 +6 -0
- data/tests/data/parser.nested-multipart +75 -0
- data/tests/data/parser.nested-simple +12 -0
- data/tests/data/parser.nested-simple2 +16 -0
- data/tests/data/parser.nested-simple3 +21 -0
- data/tests/data/parser.rfc822 +65 -0
- data/tests/data/parser.simple-mime +24 -0
- data/tests/data/parser/multipart.1 +8 -0
- data/tests/data/parser/multipart.10 +4 -0
- data/tests/data/parser/multipart.11 +12 -0
- data/tests/data/parser/multipart.12 +12 -0
- data/tests/data/parser/multipart.13 +6 -0
- data/tests/data/parser/multipart.14 +6 -0
- data/tests/data/parser/multipart.15 +6 -0
- data/tests/data/parser/multipart.16 +6 -0
- data/tests/data/parser/multipart.2 +8 -0
- data/tests/data/parser/multipart.3 +5 -0
- data/tests/data/parser/multipart.4 +6 -0
- data/tests/data/parser/multipart.5 +4 -0
- data/tests/data/parser/multipart.6 +5 -0
- data/tests/data/parser/multipart.7 +6 -0
- data/tests/data/parser/multipart.8 +8 -0
- data/tests/data/parser/multipart.9 +7 -0
- data/tests/data/transparency/absolute.1 +5 -0
- data/tests/data/transparency/absolute.2 +1 -0
- data/tests/data/transparency/absolute.3 +2 -0
- data/tests/data/transparency/absolute.4 +3 -0
- data/tests/data/transparency/absolute.5 +4 -0
- data/tests/data/transparency/absolute.6 +49 -0
- data/tests/data/transparency/message.1 +73 -0
- data/tests/data/transparency/message.2 +34 -0
- data/tests/data/transparency/message.3 +63 -0
- data/tests/data/transparency/message.4 +5 -0
- data/tests/data/transparency/message.5 +15 -0
- data/tests/data/transparency/message.6 +1185 -0
- data/tests/runtests.rb +35 -0
- data/tests/testaddress.rb +1192 -0
- data/tests/testbase.rb +207 -0
- data/tests/testheader.rb +1207 -0
- data/tests/testmailbox.rb +47 -0
- data/tests/testmboxreader.rb +161 -0
- data/tests/testmessage.rb +257 -0
- data/tests/testparser.rb +634 -0
- data/tests/testparsermultipart.rb +205 -0
- data/tests/testpushbackreader.rb +40 -0
- data/tests/testserialize.rb +264 -0
- data/tests/testtestbase.rb +112 -0
- data/tests/testtranspparency.rb +105 -0
- metadata +143 -0
data/NEWS
ADDED
@@ -0,0 +1,309 @@
|
|
1
|
+
= Changes in RubyMail 0.17 (released 2004-04-27)
|
2
|
+
|
3
|
+
- Handle parsing addresses with non-ASCII display names. We don't do
|
4
|
+
anything intelligent with the non-ASCII data, but it is passed
|
5
|
+
through in its original (invalid) non-encoded form.
|
6
|
+
|
7
|
+
- Look for From_ lines only on the first line when parsing a message.
|
8
|
+
|
9
|
+
- RMail::Header#subject= now sets the header field name to "Subject"
|
10
|
+
instead of "subject" since some mail reading software is case
|
11
|
+
sensitive and can't understand "subject: foo".
|
12
|
+
|
13
|
+
- The RMail parser now requires only whitespace after MIME multipart
|
14
|
+
boundary lines. This violates RFC2046's "NOTE TO IMPLEMENTORS"
|
15
|
+
documented in testparsermultipart.rb's test_multipart_data_12, but
|
16
|
+
it allows real-world messages created by Eudora to be parsed.
|
17
|
+
|
18
|
+
= Changes in RubyMail 0.16 (released 2003-12-26)
|
19
|
+
|
20
|
+
- Ruby 1.8.1 compatibility fixes only.
|
21
|
+
|
22
|
+
= Changes in RubyMail 0.15 (released 2003-09-17)
|
23
|
+
|
24
|
+
- Ruby 1.8.0 compatibility fixes only.
|
25
|
+
|
26
|
+
= Changes in RubyMail 0.14 (released 2003-02-08)
|
27
|
+
|
28
|
+
- Improve RDoc documentation of the library.
|
29
|
+
|
30
|
+
- Add file level comments.
|
31
|
+
- No longer document RMail::Parser::PushbackReader and
|
32
|
+
RMail::Parser::Multipart, as they are used only internally or by
|
33
|
+
those who really want to dig deep into the library. I also think
|
34
|
+
they might be changing soon.
|
35
|
+
|
36
|
+
- Add ability to
|
37
|
+
require 'rmail'
|
38
|
+
and get all of RubyMail.
|
39
|
+
|
40
|
+
- Switch to the BSD license, mainly so the license of RubyMail is not
|
41
|
+
confusing.
|
42
|
+
|
43
|
+
= Changes in RubyMail 0.13 (released 2003-02-01)
|
44
|
+
|
45
|
+
- Add convenience methods to RMail::Header that allow easy
|
46
|
+
manipulation of the To, Cc, Bcc, Reply-To, Date, Subject and
|
47
|
+
Message-Id fields. This includes unique Message-Id generation code
|
48
|
+
and robust Date field parsing and formatting.
|
49
|
+
|
50
|
+
- Add RMail::Header#set, to delete existing fields of the same name
|
51
|
+
and then add a new one.
|
52
|
+
|
53
|
+
- RMail::Address.parse now returns an RMail::Address::List instead of
|
54
|
+
an Array (existing code still works, since RMail::Address::List
|
55
|
+
inherits from Array).
|
56
|
+
|
57
|
+
- Add RMail::Address#<=>, RMail::Address#hash and RMail::Address#eql?
|
58
|
+
methods. This allows arrays of RMail::Address to be sorted as well
|
59
|
+
as allowing RMail::Address to be placed in a hash (which in turn
|
60
|
+
allows Array#uniq to work when holding RMail::Address objects).
|
61
|
+
|
62
|
+
- Add an RMail::Mailbox::MBoxReader.each_message method.
|
63
|
+
|
64
|
+
- Deleted the rmail/header/field.rb field and incorporated
|
65
|
+
RMail::Header::Field into rmail/header.rb.
|
66
|
+
|
67
|
+
- Improve uniqueness of the MIME boundary generation by including
|
68
|
+
Time.now.tv_usec.
|
69
|
+
|
70
|
+
- Correct broken docs for RMail::Header#match and RMail::Header#match?
|
71
|
+
|
72
|
+
= Changes in RubyMail 0.12 (released 2003-01-13)
|
73
|
+
|
74
|
+
- Add an install.rb script.
|
75
|
+
|
76
|
+
= Changes in RubyMail 0.11 (released 2003-01-11)
|
77
|
+
|
78
|
+
- parse->serialize "transparency" greatly improved. This means that
|
79
|
+
when you parse a message and then serialize it back out you almost
|
80
|
+
always get the exact same message back. This is true for all single
|
81
|
+
part messages as well as all validly formatted multipart MIME
|
82
|
+
messages (and even the most common invalidly formatted ones).
|
83
|
+
|
84
|
+
The result is that RMail can now be used safely in mail filters
|
85
|
+
without risking damaging cryptographic signatures in the mails.
|
86
|
+
|
87
|
+
- RMail::Header#add now uses to_str instead of to_s to convert
|
88
|
+
arguments to strings. This makes it behave more like standard
|
89
|
+
Ruby classes.
|
90
|
+
|
91
|
+
- RMail::Mailbox::MBoxReader now always makes sure the last piece of
|
92
|
+
data returned for each message is the end of line terminator, even
|
93
|
+
if one isn't present in the input.
|
94
|
+
|
95
|
+
- RMail::Parser::PushbackReader#read now takes nil argument to mean
|
96
|
+
"read all available input." Derived classes should now override
|
97
|
+
the #read_chunk method instead of #read.
|
98
|
+
|
99
|
+
= Changes in RubyMail 0.10 (released 2002-12-13)
|
100
|
+
|
101
|
+
- Added rmail/mailbox/mboxreader.rb to the distribution.
|
102
|
+
|
103
|
+
= Changes in RubyMail 0.9 (released 2002-11-30)
|
104
|
+
|
105
|
+
- New RMail::Mailbox.parse_mbox method that can be used to conveniently
|
106
|
+
read raw messages out of a Unix mbox mailbox.
|
107
|
+
|
108
|
+
- New RMail::Mailbox::MBoxReader class in
|
109
|
+
rmail/mailbox/mboxreader.rb. This class can be used to easily read
|
110
|
+
messages out of a file in Unix "mbox" format.
|
111
|
+
|
112
|
+
- The RMail::Parser::PushbackReader class
|
113
|
+
has been documented. It has moved out of rmail/parser/multipart.rb
|
114
|
+
into rmail/parser/pushbackreader.rb
|
115
|
+
|
116
|
+
- Various documentation fixes. E.g. RMail::Parser.parse can take a
|
117
|
+
string as well as an IO object.
|
118
|
+
|
119
|
+
- The RMail::Parser::PushbackReader has a setable chunk size. This
|
120
|
+
is useful mostly for testing.
|
121
|
+
|
122
|
+
- Fix an uncaught exception when parsing multipart MIME messages that
|
123
|
+
contain only a preamble and an epilogue but no body parts.
|
124
|
+
|
125
|
+
- Fix a bug where RMail::Parser.multipart? would not return true if the
|
126
|
+
multipart message actually didn't have any parts.
|
127
|
+
|
128
|
+
= Changes in RubyMail 0.8 (released 2002-03-18)
|
129
|
+
|
130
|
+
- The following has been removed from RubyMail and made part of the
|
131
|
+
RubyFilter package:
|
132
|
+
|
133
|
+
- All scripts that were in the RubyMail 0.7 bin directory.
|
134
|
+
- Mail::LDA
|
135
|
+
- Mail::Deliver
|
136
|
+
- Mail::KeyedMailbox
|
137
|
+
- Mail::MTA
|
138
|
+
- Mail::AddressTagger
|
139
|
+
|
140
|
+
This keeps RubyMail a small and simple mail package, and provides
|
141
|
+
RubyFilter as an example of how to use RubyMail to write a mail
|
142
|
+
filter.
|
143
|
+
|
144
|
+
- The Mail module has been renamed to RMail. I think "Mail" should
|
145
|
+
be reserved for things included in the standard distribution of
|
146
|
+
Ruby.
|
147
|
+
|
148
|
+
- RMail::Header#match and match? don't require the name or value
|
149
|
+
arguments to be a case insensitive Regexps. Also, when the value
|
150
|
+
argument is converted to a string, it is passed through
|
151
|
+
Regexp::escape first.
|
152
|
+
|
153
|
+
- RMail::Parser#parse can now parse from a string.
|
154
|
+
|
155
|
+
- Mail::Address#comments= can now take a simpple string to set just
|
156
|
+
one comment.
|
157
|
+
|
158
|
+
= Changes in RubyMail 0.7 (released 2002-02-26)
|
159
|
+
|
160
|
+
- A new chunked input scheme that makes parsing huge messages about 7
|
161
|
+
times faster in ruby 1.7 and 50 times faster in ruby 1.6.
|
162
|
+
|
163
|
+
When parsing a huge message that has a 2 megabyte attachment,
|
164
|
+
RubyMail running under ruby 1.7 is now faster than any email
|
165
|
+
package for ruby, perl or python.
|
166
|
+
|
167
|
+
I wrote a benchmark that reads a 2 megabyte email from a file and
|
168
|
+
writes it out again, doing this 100 times. The results are:
|
169
|
+
|
170
|
+
ruby 1.7.2 w/rubymail (100 times)
|
171
|
+
5.96s user 7.98s system 13.94s total
|
172
|
+
ruby 1.6.6 w/rubymail (100 times)
|
173
|
+
76.91s user 8.62s system 85.53s total
|
174
|
+
ruby 1.7.2 w/tmail 0.10.1 (100 times)
|
175
|
+
9.85s user 24.21s system 34.06s total
|
176
|
+
ruby 1.6.6 w/tmail 0.10.0 (100 times)
|
177
|
+
201.89s user 15.75s system 217.64s total
|
178
|
+
python 2.2 w/email (100 times)
|
179
|
+
76.73 user 15.16s system 91.89s total
|
180
|
+
perl 5.006001 w/mimetools 5.411 (parsing on disk) (100 times)
|
181
|
+
190.11s user 25.25s system 215.36s total
|
182
|
+
perl 5.006001 w/mimetools 5.411 (parsing in memory) (100 times)
|
183
|
+
962.69s user 6.77s system 969.46s total
|
184
|
+
|
185
|
+
This change also paves the way for streaming large messages
|
186
|
+
to disk when they start to get huge, so RAM isn't needlessly
|
187
|
+
used up.
|
188
|
+
|
189
|
+
- Delivery to mbox files improved.
|
190
|
+
|
191
|
+
- won't sleep forever waiting for the mailbox lock (flock)
|
192
|
+
- won't delivery to files that don't look like an mbox
|
193
|
+
(e.g. it is not a file, not in the right format).
|
194
|
+
- delivering to '/dev/null' is now a simple nop.
|
195
|
+
|
196
|
+
- Use the new File#fsync method when available in all of the mail
|
197
|
+
delivery functions.
|
198
|
+
|
199
|
+
- Add bin/rsendmail.rb as another example of how I'm using RubyMail.
|
200
|
+
|
201
|
+
- A new Mail::AddressTagger class, included for fun. Requires the
|
202
|
+
hmac-sha1 class (available in the ruby-hmac package on RAA).
|
203
|
+
|
204
|
+
= Changes in RubyMail 0.6 (released 2002-02-15)
|
205
|
+
|
206
|
+
- Multipart MIME support.
|
207
|
+
|
208
|
+
- Mail::Parser now parses arbitrarily nested multipart MIME messages.
|
209
|
+
|
210
|
+
- For the sake of dealing with multipart MIME messages, add the
|
211
|
+
following methods to Mail::Message: preamble, epilogue, multipart?,
|
212
|
+
add_part, decode, part.
|
213
|
+
|
214
|
+
- A new Mail::AddressTagger class, for tagging addresses with
|
215
|
+
cryptographically verifiable extensions akin to TMDA. Requires the
|
216
|
+
hmac-sha1 module from the RAA. (experimental, I don't currently
|
217
|
+
use this)
|
218
|
+
|
219
|
+
- A new Mail::Message#== method.
|
220
|
+
|
221
|
+
- A new Mail::Serialize class that can serialize a Mail::Message.
|
222
|
+
|
223
|
+
= Changes in RubyMail 0.5 (released 2002-02-02)
|
224
|
+
|
225
|
+
- The rdeliver.rb script is now fully documented.
|
226
|
+
|
227
|
+
- The rdeliver.rb script now evaluates the .rdeliver file in the
|
228
|
+
context of a Deliver class (as opposed to simply loading it). The
|
229
|
+
.rdeliver file must now define a Deliver#main method, where the
|
230
|
+
simplest .rdeliver file would be:
|
231
|
+
|
232
|
+
def main
|
233
|
+
lda.save("INBOX")
|
234
|
+
end
|
235
|
+
|
236
|
+
- Add a KeyedMailbox class that can be used to implement simple
|
237
|
+
mailing list style confirmations.
|
238
|
+
|
239
|
+
- Add a message= method to Mail::DeliveryAgent. This lets delivery
|
240
|
+
scripts change the message being delivered.
|
241
|
+
|
242
|
+
- Re-wrote the RFC2822 address parser. It is now more strict about
|
243
|
+
what it considers a valid address.
|
244
|
+
|
245
|
+
= Changes in RubyMail 0.4 (released 2002-01-17)
|
246
|
+
|
247
|
+
- The bin/rdeliver.rb script is now tested. Got rid of
|
248
|
+
bin/rdeliver-wrap.rb.
|
249
|
+
|
250
|
+
- Mail::DeliveryAgent::DeliveryStatus renamed to
|
251
|
+
Mail::DeliveryAgent::DeliveryComplete.
|
252
|
+
Mail::DeliveryAgent::DeliverFailure renamed to
|
253
|
+
Mail::DeliveryAgent::DeliveryPipeFailure.
|
254
|
+
|
255
|
+
- Mail::Deliver.deliver_mbox now uses File::SYNC to write the
|
256
|
+
message.
|
257
|
+
|
258
|
+
- Mail::Header and Mail::Message no longer understand how to parse
|
259
|
+
messages. Message parsing has been moved to Mail::Parser.
|
260
|
+
Mail::Parser uses the public API of Mail::Header and Mail::Message
|
261
|
+
to build up the message.
|
262
|
+
|
263
|
+
- The Mail::Header API has been greatly changed. It is now more like
|
264
|
+
Array and Hash.
|
265
|
+
|
266
|
+
- Mail::Deliver supports delivery to qmail style Maildir mailboxes.
|
267
|
+
Mail::DeliveryAgent#save will now deliver to a Maildir if the
|
268
|
+
folder's name ends in a slash. E.g. "/home/user/Maildir/".
|
269
|
+
|
270
|
+
- Mail::DeliveryAgent no longer logs an abstract of the message being
|
271
|
+
delivered. All logging is up to the users of Mail::DeliveryAgent.
|
272
|
+
|
273
|
+
= Changes in RubyMail 0.3
|
274
|
+
|
275
|
+
- Add Mail::Header.length and Mail::Header.size methods. Add
|
276
|
+
Mail::Header.match and Mail::Header.match? methods.
|
277
|
+
|
278
|
+
- Move deliver.rb to bin/rdeliver-wrap.rb and main.rb to
|
279
|
+
bin/rdeliver.rb. These are workable local delivery agent scripts
|
280
|
+
(suitable for running from .forward).
|
281
|
+
|
282
|
+
- New Mail::MTA module that provides constants for exit codes.
|
283
|
+
|
284
|
+
- New features for Mail::DeliveryAgent. Now Mail::DeliveryAgent never
|
285
|
+
calls exit, instead it throws DeliveryStatus exceptions. There is
|
286
|
+
also a new Mail::DeliveryAgent.process method that allows you to use
|
287
|
+
Mail::DeliveryAgent in block form. Mail:DeliveryAgent.exitcode will
|
288
|
+
return the correct exit code for a given DeliveryStatus exception.
|
289
|
+
|
290
|
+
= Changes in RubyMail 0.2
|
291
|
+
|
292
|
+
- HTML API documentation is now available in the doc subdirectory.
|
293
|
+
|
294
|
+
- Mail::DeliveryAgent::strip_tag is now
|
295
|
+
Mail::DeliveryAgent::strip_field_name.
|
296
|
+
|
297
|
+
- Mail::Deliver::deliver_pipe implemented. Mail::DeliveryAgent#pipe
|
298
|
+
implemented.
|
299
|
+
|
300
|
+
- Mail::DeliveryAgent#pipe and Mail::DeliveryAgent#save now report
|
301
|
+
success or failure with DeliverySuccess and DeliveryFailure
|
302
|
+
exceptions. Mail::DeliveryAgent#reject and
|
303
|
+
Mail::DeliveryAgent#defer do not yet use the exceptions (they still
|
304
|
+
call exit).
|
305
|
+
|
306
|
+
- Now runs clean under "ruby -w"
|
307
|
+
|
308
|
+
- Now works with newer rubyunit versions.
|
309
|
+
|
data/NOTES
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
-*- outline -*-
|
2
|
+
|
3
|
+
* Why RubyMail can't be completely transparent
|
4
|
+
|
5
|
+
RubyMail parses the MIME message into a document structure. If
|
6
|
+
the MIME message is invalid, RubyMail might discard invalid
|
7
|
+
portions, etc. Also, if you parse and then serialize a
|
8
|
+
RMail::Message, empty lines may be deleted or inserted around a
|
9
|
+
MIME boundary.
|
10
|
+
|
11
|
+
For these reasons, if you require a message to be output exactly
|
12
|
+
as it is put in, I suggest that you do not filter it *through*
|
13
|
+
RubyMail. Instead, parse the message and decide what to do with
|
14
|
+
it, and then save the original message.
|
data/README
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
= RubyMail
|
2
|
+
|
3
|
+
This is RubyMail, a lightweight mail library containing various
|
4
|
+
utility classes and modules that allow Ruby scripts to parse,
|
5
|
+
modify, and generate MIME mail messages.
|
6
|
+
|
7
|
+
= Requirements
|
8
|
+
|
9
|
+
Ruby 1.6.7 (or newer) or Ruby 1.8.*. Only tested under Linux, should
|
10
|
+
be fine under any Unix.
|
11
|
+
|
12
|
+
= Documentation
|
13
|
+
|
14
|
+
The documentation is in RDoc format in the doc subdirectory. Aside
|
15
|
+
from the API reference, you will be interested in guide/Intro.txt and
|
16
|
+
guide/TableOfContents.txt.
|
17
|
+
|
18
|
+
= Install
|
19
|
+
|
20
|
+
Type the following while in the package directory:
|
21
|
+
|
22
|
+
ruby install.rb config
|
23
|
+
ruby install.rb setup
|
24
|
+
ruby install.rb install
|
25
|
+
|
26
|
+
You may need special permissions to execute the last line. If you
|
27
|
+
want to just install RubyMail to a custom location, just copy the
|
28
|
+
rmail subdirectory manually.
|
29
|
+
|
30
|
+
= Status
|
31
|
+
|
32
|
+
This package works well, but I consider all API subject to change.
|
33
|
+
|
34
|
+
I very much appreciate suggestions and comments, but please think
|
35
|
+
twice about using this for production use just yet.
|
36
|
+
|
37
|
+
= Tests?
|
38
|
+
|
39
|
+
This package has a complete unit test suite (requires RubyUnit to
|
40
|
+
run). Currently all of my e-mail is processed by this library.
|
41
|
+
|
42
|
+
= Why?
|
43
|
+
|
44
|
+
It is fun.
|
45
|
+
|
46
|
+
One use for RubyMail is the RubyFilter package, available at:
|
47
|
+
|
48
|
+
http://www.lickey.com/rubyfilter/
|
49
|
+
|
50
|
+
= Alternatives
|
51
|
+
|
52
|
+
You might check out TMail as well.
|
53
|
+
|
54
|
+
= Support
|
55
|
+
|
56
|
+
To reach the author of RubyMail, send mail to matt@lickey.com.
|
57
|
+
|
58
|
+
= License
|
59
|
+
|
60
|
+
Copyright (C) 2001, 2002, 2003, 2004 Matt Armstrong. All rights
|
61
|
+
reserved.
|
62
|
+
|
63
|
+
Redistribution and use in source and binary forms, with or without
|
64
|
+
modification, are permitted provided that the following conditions are met:
|
65
|
+
|
66
|
+
1. Redistributions of source code must retain the above copyright notice,
|
67
|
+
this list of conditions and the following disclaimer.
|
68
|
+
2. Redistributions in binary form must reproduce the above copyright
|
69
|
+
notice, this list of conditions and the following disclaimer in the
|
70
|
+
documentation and/or other materials provided with the distribution.
|
71
|
+
3. The name of the author may not be used to endorse or promote products
|
72
|
+
derived from this software without specific prior written permission.
|
73
|
+
|
74
|
+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
75
|
+
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
76
|
+
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
|
77
|
+
NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
78
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
79
|
+
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
80
|
+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
81
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
82
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
83
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/THANKS
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
= Thanks to Python's email module for:
|
2
|
+
|
3
|
+
- The idea of separating parsing and serialization from the mail
|
4
|
+
classes themselves.
|
5
|
+
- A lot of the MIME multipart API.
|
6
|
+
|
7
|
+
= Thanks to Perl's MimeTools for:
|
8
|
+
|
9
|
+
- Showing me this can all be done in the scripting language (no C
|
10
|
+
extensions necessary).
|
11
|
+
- Accessing MIME parts via a File like API (thereby allowing them to
|
12
|
+
be stored on disk).
|
13
|
+
|
14
|
+
= People:
|
15
|
+
|
16
|
+
"Yoshinori K. Okuji" <okuji-at-enbug-dot-org>
|
17
|
+
|
18
|
+
- Code to parse messages from strings (though since then I did it a
|
19
|
+
much simpler way).
|
20
|
+
- Numerous other API suggestions and improvements.
|
21
|
+
|
22
|
+
Booker Bense <bbense-at-SLAC-dot-Stanford-dot-EDU>
|
23
|
+
|
24
|
+
- For prodding me to implement mbox mailbox parsing (and an initial
|
25
|
+
implementation). It took me months, but I did it!
|
data/TODO
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
In rough priority order...but please let me know if something you need
|
2
|
+
is missing.
|
3
|
+
|
4
|
+
= FIXME
|
5
|
+
|
6
|
+
- StreamHandler should get preamble_begin and preamble_end callbacks.
|
7
|
+
Same for epilogue_begin, epilogue_end.
|
8
|
+
|
9
|
+
= STOLEN
|
10
|
+
|
11
|
+
- Header continuation issue:
|
12
|
+
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=504152&group_id=5470
|
13
|
+
- Subject: =?ISO-8859-1?Q?=24=A3_Kills_IRB?=
|
14
|
+
|
15
|
+
= Documentation
|
16
|
+
|
17
|
+
- Make it clear that all strings the library works with are the ASCII
|
18
|
+
strings that are part of the RFC2822 message -- not strings in any
|
19
|
+
other charset.
|
20
|
+
|
21
|
+
- Update Intro.txt, write MIME.txt and other Guides.
|
22
|
+
|
23
|
+
= Features
|
24
|
+
|
25
|
+
- RFC2231
|
26
|
+
http://mail.python.org/pipermail/email-sig/2003-November/000032.html
|
27
|
+
|
28
|
+
- Smart handling of charset issues for text/ types.
|
29
|
+
|
30
|
+
[Goal] allow setting the body part to a given piece of data, and
|
31
|
+
RMail handles setting the appropriate MIME headers. This
|
32
|
+
requires the data to have a known charset.
|
33
|
+
|
34
|
+
Maybe this plays into the encoding solution below.
|
35
|
+
|
36
|
+
- Base64 and quoted-printable encoding
|
37
|
+
|
38
|
+
[Goal] allow setting the body part to a given piece of data, and
|
39
|
+
RMail handles setting the appropriate MIME headers and
|
40
|
+
possibly quoted-printable or base64 transcoding it if
|
41
|
+
appropriate.
|
42
|
+
|
43
|
+
This may be best done by introducing an RMail::TransferEncodedString
|
44
|
+
class that knows whether it is transcoded as binary,
|
45
|
+
quoted-printable, base64, etc. You would set RMail::Message#body to
|
46
|
+
a TransferEncodedString and RMail::Message would set the appropriate
|
47
|
+
MIME headers. If at serialization time the message body were set to
|
48
|
+
a plain String, then RMail::Message would transcode it into base64.
|
49
|
+
|
50
|
+
- An RMail::Message#attach method that takes care of setting
|
51
|
+
content-disposition, etc.
|
52
|
+
|
53
|
+
- Header folding in RMail::Header.
|
54
|
+
|
55
|
+
- A small wrapper around Net::SMTP#send_mail that takes care of:
|
56
|
+
- parsing recipients out of the various message headers
|
57
|
+
- deleting the Bcc: header
|
58
|
+
- sending the message
|
59
|
+
|
60
|
+
- Provide a way to parse just the message headers, leaving the rest in
|
61
|
+
the input stream (for use by RubyFilter). This also implies a
|
62
|
+
feature that parses a message body given a RMail::Header object and
|
63
|
+
an input stream. This should be easy -- read line by line until you
|
64
|
+
get an empty line or EOF, then pass that off to parse_header as a
|
65
|
+
string to be parsed. Parsing the body can just use a
|
66
|
+
PushbackReader.
|
67
|
+
|
68
|
+
- Handle different end of line terminators everywhere (for both
|
69
|
+
parsing and generating).
|
70
|
+
|
71
|
+
- Provide some way when parsing a message to start spooling to disk
|
72
|
+
for really large messages. This would be easy to do depending on
|
73
|
+
how message body transparency is implemented.
|
74
|
+
|
75
|
+
- MIME charset support in header fields and message bodies. This
|
76
|
+
requires m18n support in ruby, so it won't be coming soon.
|
77
|
+
|
78
|
+
- Maildir parsing.
|
79
|
+
|
80
|
+
- Simplify the Parser such that the class used to hold the parse
|
81
|
+
result can be easily changed and so the memory used can be
|
82
|
+
minimized.
|
83
|
+
|
84
|
+
The idea is to support "bogofilter" style parsing where the data of
|
85
|
+
the parse is immediately processed and thrown away but the structure
|
86
|
+
and content of the parsed message is important.
|
87
|
+
|
88
|
+
This may require extensions to header parsing, where things like the
|
89
|
+
important MIME header fields can be parsed without creating a whole
|
90
|
+
RMail::Header object.
|
91
|
+
|
92
|
+
= Minor Features
|
93
|
+
|
94
|
+
- Untainting of email addresses. See Perl's CGI::Untaint::email.
|
95
|
+
|
96
|
+
- Parser for Received: headers. See Perl's Mail::Field::Received.
|
97
|
+
|
98
|
+
= Documentation Tasks
|
99
|
+
|
100
|
+
- A "howto" like documentation.
|
101
|
+
|
102
|
+
- How to write out a base64 encoded MIME part to a file.
|
103
|
+
- How to parse a unix MBOX file.
|
104
|
+
- MIME operations (see RFC2047)
|
105
|
+
- Character sets in message bodies
|
106
|
+
- Non-textual message bodies
|
107
|
+
- Multi-part message bodies
|
108
|
+
- Textual header information in character sets other than
|
109
|
+
US-ASCII.
|
110
|
+
|
111
|
+
- Go through every class and make sure the methods are sorted in a
|
112
|
+
sensible order so the RDoc output is nice.
|