mail 2.2.5 → 2.2.19
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/CHANGELOG.rdoc +163 -7
- data/README.rdoc +56 -65
- data/Rakefile +31 -6
- data/lib/VERSION +2 -2
- data/lib/mail/attachments_list.rb +4 -4
- data/lib/mail/body.rb +6 -2
- data/lib/mail/configuration.rb +7 -1
- data/lib/mail/core_extensions/shellwords.rb +55 -0
- data/lib/mail/core_extensions/smtp.rb +24 -0
- data/lib/mail/elements/address.rb +6 -6
- data/lib/mail/elements/content_disposition_element.rb +1 -1
- data/lib/mail/elements/content_type_element.rb +2 -2
- data/lib/mail/encodings.rb +55 -57
- data/lib/mail/field.rb +2 -1
- data/lib/mail/field_list.rb +1 -1
- data/lib/mail/fields/common/common_field.rb +10 -9
- data/lib/mail/fields/common/common_message_id.rb +6 -5
- data/lib/mail/fields/common/parameter_hash.rb +14 -4
- data/lib/mail/fields/content_disposition_field.rb +1 -1
- data/lib/mail/fields/content_type_field.rb +41 -28
- data/lib/mail/fields/date_field.rb +3 -1
- data/lib/mail/fields/received_field.rb +11 -3
- data/lib/mail/fields/resent_date_field.rb +1 -1
- data/lib/mail/fields/return_path_field.rb +1 -0
- data/lib/mail/fields/unstructured_field.rb +4 -1
- data/lib/mail/header.rb +8 -5
- data/lib/mail/mail.rb +71 -57
- data/lib/mail/message.rb +518 -391
- data/lib/mail/network/delivery_methods/sendmail.rb +15 -15
- data/lib/mail/network/delivery_methods/smtp.rb +33 -6
- data/lib/mail/network/delivery_methods/smtp_connection.rb +74 -0
- data/lib/mail/network/retriever_methods/base.rb +63 -0
- data/lib/mail/network/retriever_methods/imap.rb +147 -7
- data/lib/mail/network/retriever_methods/pop3.rb +25 -44
- data/lib/mail/network/retriever_methods/test_retriever.rb +40 -0
- data/lib/mail/network.rb +4 -0
- data/lib/mail/parsers/address_lists.rb +2 -2
- data/lib/mail/parsers/address_lists.treetop +2 -2
- data/lib/mail/parsers/content_disposition.rb +166 -18
- data/lib/mail/parsers/content_disposition.treetop +1 -1
- data/lib/mail/parsers/content_type.rb +477 -49
- data/lib/mail/parsers/content_type.treetop +12 -2
- data/lib/mail/parsers/rfc2822.rb +58 -35
- data/lib/mail/parsers/rfc2822.treetop +2 -2
- data/lib/mail/part.rb +2 -2
- data/lib/mail/parts_list.rb +16 -8
- data/lib/mail/patterns.rb +7 -2
- data/lib/mail/utilities.rb +31 -1
- data/lib/mail/version.rb +10 -8
- data/lib/mail/version_specific/ruby_1_8.rb +2 -2
- data/lib/mail/version_specific/ruby_1_9.rb +29 -8
- data/lib/mail.rb +8 -4
- metadata +44 -110
- data/lib/mail/attachments_list.rbc +0 -1983
- data/lib/mail/body.rbc +0 -3809
- data/lib/mail/configuration.rbc +0 -1112
- data/lib/mail/core_extensions/nil.rbc +0 -244
- data/lib/mail/core_extensions/string.rbc +0 -0
- data/lib/mail/elements/address.rbc +0 -4112
- data/lib/mail/elements/address_list.rbc +0 -1309
- data/lib/mail/elements/content_disposition_element.rbc +0 -701
- data/lib/mail/elements/content_location_element.rbc +0 -573
- data/lib/mail/elements/content_transfer_encoding_element.rbc +0 -535
- data/lib/mail/elements/content_type_element.rbc +0 -786
- data/lib/mail/elements/date_time_element.rbc +0 -583
- data/lib/mail/elements/envelope_from_element.rbc +0 -771
- data/lib/mail/elements/message_ids_element.rbc +0 -740
- data/lib/mail/elements/mime_version_element.rbc +0 -583
- data/lib/mail/elements/phrase_list.rbc +0 -562
- data/lib/mail/elements/received_element.rbc +0 -725
- data/lib/mail/elements.rbc +0 -362
- data/lib/mail/encodings/7bit.rbc +0 -538
- data/lib/mail/encodings/8bit.rbc +0 -541
- data/lib/mail/encodings/base64.rbc +0 -629
- data/lib/mail/encodings/binary.rbc +0 -529
- data/lib/mail/encodings/quoted_printable.rbc +0 -766
- data/lib/mail/encodings/transfer_encoding.rbc +0 -1134
- data/lib/mail/encodings.rbc +0 -0
- data/lib/mail/envelope.rbc +0 -719
- data/lib/mail/field.rbc +0 -4708
- data/lib/mail/field_list.rbc +0 -518
- data/lib/mail/fields/bcc_field.rbc +0 -564
- data/lib/mail/fields/cc_field.rbc +0 -579
- data/lib/mail/fields/comments_field.rbc +0 -383
- data/lib/mail/fields/common/address_container.rbc +0 -363
- data/lib/mail/fields/common/common_address.rbc +0 -3550
- data/lib/mail/fields/common/common_date.rbc +0 -908
- data/lib/mail/fields/common/common_field.rbc +0 -973
- data/lib/mail/fields/common/common_message_id.rbc +0 -1051
- data/lib/mail/fields/common/parameter_hash.rbc +0 -1335
- data/lib/mail/fields/content_description_field.rbc +0 -396
- data/lib/mail/fields/content_disposition_field.rbc +0 -1440
- data/lib/mail/fields/content_id_field.rbc +0 -1236
- data/lib/mail/fields/content_location_field.rbc +0 -892
- data/lib/mail/fields/content_transfer_encoding_field.rbc +0 -1184
- data/lib/mail/fields/content_type_field.rbc +0 -3958
- data/lib/mail/fields/date_field.rbc +0 -712
- data/lib/mail/fields/from_field.rbc +0 -579
- data/lib/mail/fields/in_reply_to_field.rbc +0 -579
- data/lib/mail/fields/keywords_field.rbc +0 -979
- data/lib/mail/fields/message_id_field.rbc +0 -1008
- data/lib/mail/fields/mime_version_field.rbc +0 -1107
- data/lib/mail/fields/optional_field.rbc +0 -153
- data/lib/mail/fields/received_field.rbc +0 -1137
- data/lib/mail/fields/references_field.rbc +0 -574
- data/lib/mail/fields/reply_to_field.rbc +0 -579
- data/lib/mail/fields/resent_bcc_field.rbc +0 -579
- data/lib/mail/fields/resent_cc_field.rbc +0 -579
- data/lib/mail/fields/resent_date_field.rbc +0 -656
- data/lib/mail/fields/resent_from_field.rbc +0 -579
- data/lib/mail/fields/resent_message_id_field.rbc +0 -639
- data/lib/mail/fields/resent_sender_field.rbc +0 -731
- data/lib/mail/fields/resent_to_field.rbc +0 -579
- data/lib/mail/fields/return_path_field.rbc +0 -737
- data/lib/mail/fields/sender_field.rbc +0 -799
- data/lib/mail/fields/structured_field.rbc +0 -671
- data/lib/mail/fields/subject_field.rbc +0 -378
- data/lib/mail/fields/to_field.rbc +0 -579
- data/lib/mail/fields/unstructured_field.rbc +0 -2292
- data/lib/mail/fields.rbc +0 -782
- data/lib/mail/header.rbc +0 -3720
- data/lib/mail/mail.rbc +0 -2168
- data/lib/mail/message.rbc +0 -19034
- data/lib/mail/network/delivery_methods/file_delivery.rbc +0 -722
- data/lib/mail/network/delivery_methods/sendmail.rbc +0 -800
- data/lib/mail/network/delivery_methods/smtp.rbc +0 -1081
- data/lib/mail/network/delivery_methods/test_mailer.rbc +0 -552
- data/lib/mail/network/retriever_methods/pop3.rbc +0 -2447
- data/lib/mail/network.rbc +0 -236
- data/lib/mail/parsers/address_lists.rbc +0 -1307
- data/lib/mail/parsers/content_disposition.rbc +0 -5968
- data/lib/mail/parsers/content_location.rbc +0 -2166
- data/lib/mail/parsers/content_transfer_encoding.rbc +0 -2591
- data/lib/mail/parsers/content_type.rbc +0 -7949
- data/lib/mail/parsers/date_time.rbc +0 -1836
- data/lib/mail/parsers/envelope_from.rbc +0 -3106
- data/lib/mail/parsers/message_ids.rbc +0 -989
- data/lib/mail/parsers/mime_version.rbc +0 -2254
- data/lib/mail/parsers/phrase_lists.rbc +0 -989
- data/lib/mail/parsers/received.rbc +0 -1267
- data/lib/mail/parsers/rfc2045.rbc +0 -5614
- data/lib/mail/parsers/rfc2822.rbc +0 -74848
- data/lib/mail/parsers/rfc2822_obsolete.rbc +0 -55220
- data/lib/mail/part.rbc +0 -2314
- data/lib/mail/parts_list.rbc +0 -832
- data/lib/mail/patterns.rbc +0 -0
- data/lib/mail/utilities.rbc +0 -2377
- data/lib/mail/version.rbc +0 -450
- data/lib/mail/version_specific/ruby_1_8.rbc +0 -2496
- data/lib/mail.rbc +0 -1151
- data/lib/tasks/corpus.rake.compiled.rbc +0 -2195
- data/lib/tasks/treetop.rake.compiled.rbc +0 -297
data/CHANGELOG.rdoc
CHANGED
|
@@ -1,3 +1,159 @@
|
|
|
1
|
+
== Tue Apr 26 09:49:54 UTC 2011 Mikel Lindsaar <mikel@rubyx.com>
|
|
2
|
+
|
|
3
|
+
* Update activesupport require to use inflector - closes #217
|
|
4
|
+
|
|
5
|
+
== Tue Apr 26 06:18:19 UTC 2011 Mikel Lindsaar <mikel@rubyx.com>
|
|
6
|
+
|
|
7
|
+
* Fixed charset warning issue with multipart messages - https://github.com/arvindsv
|
|
8
|
+
* Version bump to 2.2.18 and gem release
|
|
9
|
+
|
|
10
|
+
== Wed 20 Apr 2011 15:16:20 UTC Mikel Lindsaar <mikel@rubyx.com>
|
|
11
|
+
|
|
12
|
+
* Mail::Field.new("Subject: foobar", 'iso-2022-jp') does not set charset - https://github.com/yalab
|
|
13
|
+
|
|
14
|
+
== Tue Apr 19 00:20:54 UTC 2011 Mikel Lindsaar <mikel@rubyx.com>
|
|
15
|
+
|
|
16
|
+
* Fixed an exception with nil in Reply-To and References field - https://github.com/dcormier
|
|
17
|
+
* Version bump to 2.2.17 and gem release
|
|
18
|
+
|
|
19
|
+
== Sat Apr 16 12:57:27 UTC 2011 Mikel Lindsaar <mikel@rubyx.com>
|
|
20
|
+
|
|
21
|
+
* Added support for open SMTP connections and returning the Mail server's response - https://github.com/spiegela
|
|
22
|
+
* RE: not appended to subject when replying to a reply - https://github.com/prateekdayal
|
|
23
|
+
* Support not ascii compatible charset mail send - https://github.com/yalab
|
|
24
|
+
* Fix for issue 208 "mail.body after mail.add_file truncates message body" - https://github.com/glongman
|
|
25
|
+
* Handle bad subject encoding (or ":invalid => :replace" is ineffective for utf-8 to utf-8 encoding) - https://github.com/choonkeat
|
|
26
|
+
* Handle blank Received header field - https://github.com/bcantin
|
|
27
|
+
* Handle part with missing content type - https://github.com/bcantin
|
|
28
|
+
* Handle a "<>" Return field - https://github.com/bcantin
|
|
29
|
+
* Performance improvements for 1.9 - https://github.com/nobu
|
|
30
|
+
* Fix heavy CPU issues when messages are missing a space - https://github.com/scsmith
|
|
31
|
+
* Tighten up allowed encodings - https://github.com/scsmith
|
|
32
|
+
* Added to_yaml & from_yaml (as well as to_hash & from_hash) - https://github.com/srushti
|
|
33
|
+
* Fix up some comments - https://github.com/takahashim
|
|
34
|
+
* Version bump to 2.2.16 and gem release
|
|
35
|
+
|
|
36
|
+
== Wed 26 Jan 2011 02:23:09 UTC Mikel Lindsaar <mikel@rubyx.com>
|
|
37
|
+
|
|
38
|
+
* Update addresses passed into sendmail to escape them (Andy Lindeman)
|
|
39
|
+
* Version bump to 2.2.15 and gem release
|
|
40
|
+
|
|
41
|
+
== Mon 3 Jan 2011 12:48:59 UTC Mikel Lindsaar <mikel@rubyx.com>
|
|
42
|
+
|
|
43
|
+
* Update field_spec to handle encodings, closes issues 44 and 120 (Luis Lopez)
|
|
44
|
+
* Version bump to 2.2.14 and gem release
|
|
45
|
+
|
|
46
|
+
== Mon 3 Jan 2011 00:09:27 UTC Mikel Lindsaar <mikel@rubyx.com>
|
|
47
|
+
|
|
48
|
+
* Use default IANA port on the IMAP retriever_method (Adrian Silva)
|
|
49
|
+
* Updated README to reflect latest ruby versions we test against (mikel)
|
|
50
|
+
* Only remove tlsconnect if it exists (mikel)
|
|
51
|
+
|
|
52
|
+
== Thu 23 Dec 2010 09:15:58 UTC Mikel Lindsaar <mikel@rubyx.com>
|
|
53
|
+
|
|
54
|
+
* Added backport fix for net/smtp bug (Aaron Patterson)
|
|
55
|
+
* Changed "Mail#text_part" so that it does not return a plain text attachment (Anton Mironov)
|
|
56
|
+
* Added in rescue blocks for badly formatted dates as well as encoding problems (Karl Baum)
|
|
57
|
+
* Fixed warning errors of duplicated regular expressions (Kouhei Sutou)
|
|
58
|
+
* Removed duplication from Regex's containing [\w\d]+ as \w contains \d (mikel)
|
|
59
|
+
* Add authentication selection for imap retriever (Björn Albers)
|
|
60
|
+
* Removing warning on @name not being initialized (mikel)
|
|
61
|
+
* Version bump to 2.2.13 and gem release
|
|
62
|
+
|
|
63
|
+
== Fri 10 Dec 2010 09:06:49 UTC Mikel Lindsaar <mikel@rubyx.com>
|
|
64
|
+
|
|
65
|
+
* Fixing problems with multibyte filenamed attachment (amatsuda)
|
|
66
|
+
* Providing IMAP uid and imap object as options to IMAP calls (dball)
|
|
67
|
+
* Fixing filename for windows (mikel)
|
|
68
|
+
|
|
69
|
+
== Sun Dec 5 02:24:55 UTC 2010 Mikel Lindsaar <mikel@rubyx.com>
|
|
70
|
+
|
|
71
|
+
* Updating requirement on i18n to be more relaxed for now until we nuke ActiveSupport dependency (Mikel)
|
|
72
|
+
* Version bump to 2.2.12 and gem release
|
|
73
|
+
|
|
74
|
+
== Tue 30 Nov 2010 00:36:11 UTC Mikel Lindsaar <mikel@rubyx.com>
|
|
75
|
+
|
|
76
|
+
* Allow address lists to handle and ignore empty addresses (Donald Ball)
|
|
77
|
+
* Allow address lists to handle repeating strings of commas (Donald Ball)
|
|
78
|
+
* Noting pending test for malformed folding whitespace (Donald Ball)
|
|
79
|
+
* Adding spec to test error email for missing addresses in to header (Mikel)
|
|
80
|
+
* Bumping i18n dependency to ~> 0.5.0
|
|
81
|
+
* Version bump to 2.2.11 and gem release
|
|
82
|
+
|
|
83
|
+
== Wed 17 Nov 2010 00:43:31 UTC Mikel Lindsaar <mikel@rubyx.com>
|
|
84
|
+
|
|
85
|
+
* Added test retriever and updated documentation (Donald Ball)
|
|
86
|
+
* Fix test suite to work in any timezone (Donald Ball)
|
|
87
|
+
* Added dependency for tlsmail for Ruby 1.8.6 (Donald Ball)
|
|
88
|
+
* Added new feature, replies for mail message
|
|
89
|
+
* Fix references header to use CFWS instead of comma as the separator per RFC2822
|
|
90
|
+
* Version Bum to 2.2.10 and pushed.
|
|
91
|
+
|
|
92
|
+
== Mon Nov 15 13:04:41 UTC 2010 Mikel Lindsaar <mikel@rubyx.com>
|
|
93
|
+
|
|
94
|
+
* Add find_and_delete convenience method for consistency with POP3, document delete_after_find option (Donald Ball)
|
|
95
|
+
* Documenting the openssl_verify_mode setting (Donald Ball)
|
|
96
|
+
* Added ruby-1.8.6 back into the list of tested platforms (Donald Ball)
|
|
97
|
+
* Relax i18n dependency until we remove active support requirement
|
|
98
|
+
* Version Bump to 2.2.9.1 to include new i18n dependency
|
|
99
|
+
|
|
100
|
+
== Tue Oct 26 07:14:36 UTC 2010 Mikel Lindsaar <mikel@rubyx.com>
|
|
101
|
+
|
|
102
|
+
* Version Bump to 2.2.9 and tag
|
|
103
|
+
* Updating Gemfile and gemspec to include i18n and sync dependency versions
|
|
104
|
+
* Added work from Kendall Gifford closing issues #104, #107 and #117
|
|
105
|
+
* Always encode mailbox names with UTF-7 (github: fasta)
|
|
106
|
+
|
|
107
|
+
== Tue Oct 26 06:43:17 UTC 2010 Mikel Lindsaar <mikel@rubyx.com>
|
|
108
|
+
|
|
109
|
+
* Added updates from Donald Ball (github: dball) to improve 1.8.6 support
|
|
110
|
+
* Added patch from Ryan Bigg (github: ryanb) for #mark_for_delete
|
|
111
|
+
|
|
112
|
+
== Thu Oct 7 15:44:31 UTC 2010 Mikel Lindsaar <mikel@rubyx.com>
|
|
113
|
+
|
|
114
|
+
* Version Bump to 2.2.7
|
|
115
|
+
* Release 2.2.7
|
|
116
|
+
|
|
117
|
+
== Thu Oct 7 15:42:57 UTC 2010 Mikel Lindsaar <mikel@rubyx.com>
|
|
118
|
+
|
|
119
|
+
* Added fix for Windows using 'rb' flags, thanks to Luis Lavena and dzhang for pointing it out
|
|
120
|
+
* Fixed up Rakefile to require bundler to run specs and give more appropriate errors messages if this fails
|
|
121
|
+
|
|
122
|
+
== Tue Sep 28 14:59:03 UTC 2010 Mikel Lindsaar <mikel@rubyx.com>
|
|
123
|
+
|
|
124
|
+
* Merged POP3 delete support work from Michael Prendergast
|
|
125
|
+
* Merged IMAP support work from Fabian Staubli
|
|
126
|
+
|
|
127
|
+
== Mon Sep 13 02:31:21 UTC 2010 Mikel Lindsaar <mikel@rubyx.com>
|
|
128
|
+
|
|
129
|
+
* Replace some missing documentation
|
|
130
|
+
* Version bump to 2.2.6.1
|
|
131
|
+
|
|
132
|
+
== Sat 11 Sep 2010 05:13:36 UTC Mikel Lindsaar <mikel@rubyx.com>
|
|
133
|
+
|
|
134
|
+
* Fixed parsing an email with an empty In-Reply-To header (Reported by Eugene Pimenov)
|
|
135
|
+
* Adding address spec for groupname+domain.com@example.com format emails
|
|
136
|
+
* Version bump to 2.2.6
|
|
137
|
+
|
|
138
|
+
== Sat Sep 11 01:56:59 UTC 2010 Mikel Lindsaar <mikel@rubyx.com>
|
|
139
|
+
|
|
140
|
+
* Added new way to do versioning for rubygems
|
|
141
|
+
* Added additional specs for Content-Disposition: inline which are not being encoded correctly - Shawn Pyle
|
|
142
|
+
* Make sure Mail::Message#attachment? returns true/false - Simone Carletti
|
|
143
|
+
* Replace hard-coded references to Mail with more generic self references to allow easier inheritance (closes #61) - Simone Carletti
|
|
144
|
+
* Force encoding on Regexp for Ruby 1.9 to avoid encoding conflicts - Golubev Pavel
|
|
145
|
+
* Added lazy evaluation to message body: body is not parsed until need. It greatly improves performance with big mails if you don't need to read the body (yet)
|
|
146
|
+
* Added Mail.read_from_string as an explicit method (mcansky)
|
|
147
|
+
* Fixed bounce detection for multipart reports that contain a human readable report status part
|
|
148
|
+
* Closed Issue #65 found (incredibly) by quetz - major Kudos for bug hunting
|
|
149
|
+
* Fixed missing trailing CRLF in content type field - Closes issue #57 - Kudos to Henry Flower for finding it
|
|
150
|
+
* Version bump to 2.2.5.2
|
|
151
|
+
|
|
152
|
+
== Sat Sep 11 01:32:13 UTC 2010 Mikel Lindsaar <mikel@rubyx.com>
|
|
153
|
+
|
|
154
|
+
* Closed issue #58 - Content Type not parsing unless lower case.
|
|
155
|
+
* Version bump to 2.2.5.1
|
|
156
|
+
|
|
1
157
|
== Thu 17 Jun 2010 22:13:18 UTC Mikel Lindsaar <mikel@rubyx.com>
|
|
2
158
|
|
|
3
159
|
* Added Mail::POP3.delete_all, including specs (Martijn Storck)
|
|
@@ -109,7 +265,7 @@
|
|
|
109
265
|
|
|
110
266
|
== Sun Jan 28 02:59:34 UTC 2010 Mikel Lindsaar <raasdnil@gmail.com>
|
|
111
267
|
|
|
112
|
-
* Removed old method of setting delivery_method
|
|
268
|
+
* Removed old method of setting delivery_method
|
|
113
269
|
|
|
114
270
|
== Mon Jan 25 11:36:13 UTC 2010 Mikel Lindsaar <raasdnil@gmail.com>
|
|
115
271
|
|
|
@@ -148,13 +304,13 @@
|
|
|
148
304
|
* Message now adds multipart/mixed as the content type if nothing is set and there are parts to the message
|
|
149
305
|
* Added #display_names and #addrs to all address fields. #addrs returns the actual Mail::Address object for each address in the field.
|
|
150
306
|
* Body should call to_s on given input... incase someone gave it an IO.readlines result (Array)
|
|
151
|
-
*
|
|
307
|
+
*
|
|
152
308
|
|
|
153
309
|
== Thu Jan 21 05:27:17 UTC 2010 Mikel Lindsaar <raasdnil@gmail.com>
|
|
154
310
|
|
|
155
311
|
* Version bump to 2.0.2
|
|
156
312
|
* Major change to attachments, add_file now only accepts
|
|
157
|
-
{:filename => 'full/path/to/file.png'} or
|
|
313
|
+
{:filename => 'full/path/to/file.png'} or
|
|
158
314
|
{:filename => 'file.png', :content => 'string of file content'}
|
|
159
315
|
you can also now do mail.attachments['filename.png'] = File.read('path/to/file.png')
|
|
160
316
|
which is nice too!
|
|
@@ -229,8 +385,8 @@
|
|
|
229
385
|
|
|
230
386
|
== Sun Dec 27 09:51:27 UTC 2009 Mikel Lindsaar <raasdnil@gmail.com>
|
|
231
387
|
|
|
232
|
-
* Version bump to 1.4 because now :to_s calls :decoded for all fields and body
|
|
233
|
-
while :to_s calls :encoded for Message and Header containers. Makes sense...
|
|
388
|
+
* Version bump to 1.4 because now :to_s calls :decoded for all fields and body
|
|
389
|
+
while :to_s calls :encoded for Message and Header containers. Makes sense...
|
|
234
390
|
really.
|
|
235
391
|
|
|
236
392
|
== Sun Dec 27 07:30:02 UTC 2009 Mikel Lindsaar <raasdnil@gmail.com>
|
|
@@ -339,7 +495,7 @@
|
|
|
339
495
|
|
|
340
496
|
== Fri Nov 6 22:52:10 UTC 2009 Mikel Lindsaar <raasdnil@gmail.com>
|
|
341
497
|
|
|
342
|
-
* a6ef2b4: Fixed Issue #4 - Can't call encoding on non existant
|
|
498
|
+
* a6ef2b4: Fixed Issue #4 - Can't call encoding on non existant
|
|
343
499
|
content-transer-encoding header
|
|
344
500
|
|
|
345
501
|
== Fri Nov 6 00:51:55 UTC 2009 Mikel Lindsaar <raasdnil@gmail.com>
|
|
@@ -380,7 +536,7 @@
|
|
|
380
536
|
== Sun Nov 1 12:00:00 UTC 2009 Mikel Lindsaar <raasdnil@gmail.com>
|
|
381
537
|
|
|
382
538
|
* handle OpenSSL::SSL::VERIFY_NONE returning 0 <jlindley>
|
|
383
|
-
* doing Mail.new { content_type [text, plain, { charset => UTF-8 }] } is now
|
|
539
|
+
* doing Mail.new { content_type [text, plain, { charset => UTF-8 }] } is now
|
|
384
540
|
possible (content type accepts an array) <mikel>
|
|
385
541
|
|
|
386
542
|
== Sat Oct 31 11:00:41 UTC 2009 Mikel Lindsaar <raasdnil@gmail.com>
|
data/README.rdoc
CHANGED
|
@@ -27,15 +27,11 @@ you are doing, you can fiddle with every last bit of your email directly.
|
|
|
27
27
|
|
|
28
28
|
Mail is tested and works on the following platforms:
|
|
29
29
|
|
|
30
|
-
* jruby-1.
|
|
31
|
-
* ree-1.8.7-2010.
|
|
32
|
-
* ruby-1.8.
|
|
33
|
-
* ruby-1.
|
|
34
|
-
* ruby-1.9.2-
|
|
35
|
-
|
|
36
|
-
Mail seems to work fine on JRuby as well, however there is some weird QP
|
|
37
|
-
problem that only shows up while running the specs, running it directly
|
|
38
|
-
works fine.... weird. Any jRuby gurus who want to help out, please do.
|
|
30
|
+
* jruby-1.5.2 [ [x86_64-java] ]
|
|
31
|
+
* ree-1.8.7-2010.02 [ x86_64 ]
|
|
32
|
+
* ruby-1.8.6-p399 [ x86_64 ]
|
|
33
|
+
* ruby-1.8.7-p302 [ x86_64 ]
|
|
34
|
+
* ruby-1.9.2-p0 [ x86_64 ]
|
|
39
35
|
|
|
40
36
|
== Discussion
|
|
41
37
|
|
|
@@ -62,7 +58,7 @@ field and continue parsing.
|
|
|
62
58
|
|
|
63
59
|
This means Mail won't (ever) crunch your data (I think).
|
|
64
60
|
|
|
65
|
-
You can also create MIME emails. There are helper methods for making a
|
|
61
|
+
You can also create MIME emails. There are helper methods for making a
|
|
66
62
|
multipart/alternate email for text/plain and text/html (the most common pair)
|
|
67
63
|
and you can manually create any other type of MIME email.
|
|
68
64
|
|
|
@@ -72,7 +68,6 @@ Next TODO:
|
|
|
72
68
|
|
|
73
69
|
* Improve MIME support for character sets in headers, currently works, mostly, needs
|
|
74
70
|
refinement.
|
|
75
|
-
* Add IMAP wrapper
|
|
76
71
|
|
|
77
72
|
== Testing Policy
|
|
78
73
|
|
|
@@ -93,23 +88,10 @@ Also, all private or protected methods to be declared as such - though this is s
|
|
|
93
88
|
|
|
94
89
|
== Installation
|
|
95
90
|
|
|
96
|
-
Installation is fairly simple, I host mail on
|
|
91
|
+
Installation is fairly simple, I host mail on rubygems, so you can just do:
|
|
97
92
|
|
|
98
93
|
# gem install mail
|
|
99
94
|
|
|
100
|
-
if you are on gemcutter, if you aren't, you can by doing:
|
|
101
|
-
|
|
102
|
-
# gem install gemcutter
|
|
103
|
-
# gem tumble
|
|
104
|
-
# gem install mail
|
|
105
|
-
|
|
106
|
-
Warning though, the above will change your first gem repository to gemcutter, this
|
|
107
|
-
may or may not be a problem for you.
|
|
108
|
-
|
|
109
|
-
If you want to install mail manually, you can download the gem from github and do:
|
|
110
|
-
|
|
111
|
-
# gem install mail-2.2.0.gem
|
|
112
|
-
|
|
113
95
|
== Encodings
|
|
114
96
|
|
|
115
97
|
If you didn't know, handling encodings in Emails is not as straight forward as you
|
|
@@ -121,26 +103,26 @@ I have tried to simplify it some:
|
|
|
121
103
|
return the object as a complete string ready to send in the mail system, that is,
|
|
122
104
|
it will include the header field and value and CRLF at the end and wrapped as
|
|
123
105
|
needed.
|
|
124
|
-
|
|
106
|
+
|
|
125
107
|
2. All objects that can render into an email, have a :decoded method. Decoded will
|
|
126
108
|
return the object's "value" only as a string. This means it will not include
|
|
127
109
|
the header fields (like 'To:' or 'Subject:').
|
|
128
|
-
|
|
110
|
+
|
|
129
111
|
3. By default, calling :to_s on a container object will call it's encoded method, while
|
|
130
112
|
:to_s on a field object will call it's decoded method. So calling :to_s on a Mail
|
|
131
113
|
object will return the mail, all encoded ready to send, while calling :to_s on the
|
|
132
114
|
From field or the body will return the decoded value of the object. The header object
|
|
133
115
|
of Mail is considered a container. If you are in doubt, call :encoded, or :decoded
|
|
134
116
|
explicitly, this is safer if you are not sure.
|
|
135
|
-
|
|
117
|
+
|
|
136
118
|
4. Structured fields that have parameter values that can be encoded (e.g. Content-Type) will
|
|
137
119
|
provide decoded parameter values when you call the parameter names as methods against
|
|
138
120
|
the object.
|
|
139
|
-
|
|
121
|
+
|
|
140
122
|
5. Structured fields that have parameter values that can be encoded (e.g. Content-Type) will
|
|
141
|
-
provide encoded parameter values when you call the parameter names through the
|
|
123
|
+
provide encoded parameter values when you call the parameter names through the
|
|
142
124
|
object.parameters['<parameter_name>'] method call.
|
|
143
|
-
|
|
125
|
+
|
|
144
126
|
== Contributing
|
|
145
127
|
|
|
146
128
|
Please do! Contributing is easy in Mail:
|
|
@@ -162,7 +144,7 @@ So, you should be able to just "require 'mail'" to get started.
|
|
|
162
144
|
=== Making an email
|
|
163
145
|
|
|
164
146
|
require 'mail'
|
|
165
|
-
|
|
147
|
+
|
|
166
148
|
mail = Mail.new do
|
|
167
149
|
from 'mikel@test.lindsaar.net'
|
|
168
150
|
to 'you@test.lindsaar.net'
|
|
@@ -175,7 +157,7 @@ So, you should be able to just "require 'mail'" to get started.
|
|
|
175
157
|
=== Making an email, have it your way:
|
|
176
158
|
|
|
177
159
|
require 'mail'
|
|
178
|
-
|
|
160
|
+
|
|
179
161
|
mail = Mail.new do
|
|
180
162
|
body File.read('body.txt')
|
|
181
163
|
end
|
|
@@ -183,35 +165,35 @@ So, you should be able to just "require 'mail'" to get started.
|
|
|
183
165
|
mail['from'] = 'mikel@test.lindsaar.net'
|
|
184
166
|
mail[:to] = 'you@test.lindsaar.net'
|
|
185
167
|
mail.subject = 'This is a test email'
|
|
186
|
-
|
|
168
|
+
|
|
187
169
|
mail.to_s #=> "From: mikel@test.lindsaar.net\r\nTo: you@...
|
|
188
170
|
|
|
189
171
|
=== Don't Worry About Message IDs:
|
|
190
172
|
|
|
191
173
|
require 'mail'
|
|
192
|
-
|
|
174
|
+
|
|
193
175
|
mail = Mail.new do
|
|
194
176
|
to 'you@test.lindsaar.net'
|
|
195
177
|
body 'Some simple body'
|
|
196
178
|
end
|
|
197
179
|
|
|
198
180
|
mail.to_s =~ /Message\-ID: <[\d\w_]+@.+.mail/ #=> 27
|
|
199
|
-
|
|
181
|
+
|
|
200
182
|
Mail will automatically add a Message-ID field if it is missing and
|
|
201
183
|
give it a unique, random Message-ID along the lines of:
|
|
202
184
|
|
|
203
185
|
<4a7ff76d7016_13a81ab802e1@local.fqdn.mail>
|
|
204
|
-
|
|
186
|
+
|
|
205
187
|
=== Or do worry about Message-IDs:
|
|
206
188
|
|
|
207
189
|
require 'mail'
|
|
208
|
-
|
|
190
|
+
|
|
209
191
|
mail = Mail.new do
|
|
210
192
|
to 'you@test.lindsaar.net'
|
|
211
193
|
message_id '<ThisIsMyMessageId@some.domain.com>'
|
|
212
194
|
body 'Some simple body'
|
|
213
195
|
end
|
|
214
|
-
|
|
196
|
+
|
|
215
197
|
mail.to_s =~ /Message\-ID: <ThisIsMyMessageId@some.domain.com>/ #=> 27
|
|
216
198
|
|
|
217
199
|
Mail will take the message_id you assign to it trusting that you know
|
|
@@ -219,7 +201,7 @@ what you are doing.
|
|
|
219
201
|
|
|
220
202
|
=== Sending an email:
|
|
221
203
|
|
|
222
|
-
Mail defaults to sending via SMTP to local host port 25. If you have a
|
|
204
|
+
Mail defaults to sending via SMTP to local host port 25. If you have a
|
|
223
205
|
sendmail or postfix daemon running on on this port, sending email is as
|
|
224
206
|
easy as:
|
|
225
207
|
|
|
@@ -232,7 +214,7 @@ easy as:
|
|
|
232
214
|
end
|
|
233
215
|
|
|
234
216
|
or
|
|
235
|
-
|
|
217
|
+
|
|
236
218
|
mail = Mail.new do
|
|
237
219
|
from 'me@test.lindsaar.net'
|
|
238
220
|
to 'you@test.lindsaar.net'
|
|
@@ -240,7 +222,7 @@ or
|
|
|
240
222
|
body File.read('body.txt')
|
|
241
223
|
add_file {:filename => 'somefile.png', :content => File.read('/somefile.png')}
|
|
242
224
|
end
|
|
243
|
-
|
|
225
|
+
|
|
244
226
|
mail.deliver!
|
|
245
227
|
|
|
246
228
|
Sending via sendmail can be done like so:
|
|
@@ -252,13 +234,18 @@ Sending via sendmail can be done like so:
|
|
|
252
234
|
body File.read('body.txt')
|
|
253
235
|
add_file {:filename => 'somefile.png', :content => File.read('/somefile.png')}
|
|
254
236
|
end
|
|
255
|
-
|
|
237
|
+
|
|
256
238
|
mail.delivery_method :sendmail
|
|
257
|
-
|
|
239
|
+
|
|
258
240
|
mail.deliver
|
|
259
241
|
|
|
260
|
-
|
|
242
|
+
{Learn more about SMTP Delivery}[link:classes/Mail/SMTP.html]
|
|
243
|
+
|
|
244
|
+
{Learn more about File Delivery}[link:classes/Mail/FileDelivery.html]
|
|
261
245
|
|
|
246
|
+
{Learn more about Sendmail Delivery}[link:classes/Mail/Sendmail.html]
|
|
247
|
+
|
|
248
|
+
{Learn more about Test Email Delivery}[link:classes/Mail/TestMailer.html]
|
|
262
249
|
|
|
263
250
|
=== Getting emails from a pop server:
|
|
264
251
|
|
|
@@ -305,12 +292,16 @@ Or even all emails:
|
|
|
305
292
|
|
|
306
293
|
emails.length #=> LOTS!
|
|
307
294
|
|
|
295
|
+
{Learn more about POP3}[link:classes/Mail/POP3.html]
|
|
296
|
+
|
|
297
|
+
{Learn more about IMAP}[link:classes/Mail/IMAP.html]
|
|
298
|
+
|
|
308
299
|
=== Reading an Email
|
|
309
300
|
|
|
310
301
|
require 'mail'
|
|
311
|
-
|
|
302
|
+
|
|
312
303
|
mail = Mail.read('/path/to/message.eml')
|
|
313
|
-
|
|
304
|
+
|
|
314
305
|
mail.envelope.from #=> 'mikel@test.lindsaar.net'
|
|
315
306
|
mail.from.addresses #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
|
|
316
307
|
mail.sender.address #=> 'mikel@test.lindsaar.net'
|
|
@@ -326,9 +317,9 @@ Many more methods available.
|
|
|
326
317
|
=== Reading a Multipart Email
|
|
327
318
|
|
|
328
319
|
require 'mail'
|
|
329
|
-
|
|
320
|
+
|
|
330
321
|
mail = Mail.read('multipart_email')
|
|
331
|
-
|
|
322
|
+
|
|
332
323
|
mail.multipart? #=> true
|
|
333
324
|
mail.parts.length #=> 2
|
|
334
325
|
mail.preamble #=> "Text before the first part"
|
|
@@ -346,7 +337,7 @@ content type and has a boundary defined.
|
|
|
346
337
|
|
|
347
338
|
=== Writing and sending a multipart/alternative (html and text) email
|
|
348
339
|
|
|
349
|
-
Mail makes some basic assumptions and makes doing the common thing as
|
|
340
|
+
Mail makes some basic assumptions and makes doing the common thing as
|
|
350
341
|
simple as possible.... (asking a lot from a mail library)
|
|
351
342
|
|
|
352
343
|
require 'mail'
|
|
@@ -363,7 +354,7 @@ simple as possible.... (asking a lot from a mail library)
|
|
|
363
354
|
body '<h1>This is HTML</h1>'
|
|
364
355
|
end
|
|
365
356
|
end
|
|
366
|
-
|
|
357
|
+
|
|
367
358
|
Mail then delivers the email at the end of the block and returns the
|
|
368
359
|
resulting Mail::Message object, which you can then inspect if you
|
|
369
360
|
so desire...
|
|
@@ -399,7 +390,7 @@ so desire...
|
|
|
399
390
|
<h1>This is HTML</h1>
|
|
400
391
|
----==_mimepart_4a914f0c911be_6f0f1ab8026659--
|
|
401
392
|
|
|
402
|
-
Mail inserts the content transfer encoding, the mime version,
|
|
393
|
+
Mail inserts the content transfer encoding, the mime version,
|
|
403
394
|
the content-id's and handles the content-type and boundary.
|
|
404
395
|
|
|
405
396
|
Mail assumes that if your text in the body is only us-ascii, that your
|
|
@@ -413,7 +404,7 @@ can just do it declaratively. However, you need to add Mail::Parts to
|
|
|
413
404
|
an email, not Mail::Messages.
|
|
414
405
|
|
|
415
406
|
require 'mail'
|
|
416
|
-
|
|
407
|
+
|
|
417
408
|
mail = Mail.new do
|
|
418
409
|
to 'nicolas@test.lindsaar.net.au'
|
|
419
410
|
from 'Mikel Lindsaar <mikel@test.lindsaar.net.au>'
|
|
@@ -423,12 +414,12 @@ an email, not Mail::Messages.
|
|
|
423
414
|
text_part = Mail::Part.new do
|
|
424
415
|
body 'This is plain text'
|
|
425
416
|
end
|
|
426
|
-
|
|
417
|
+
|
|
427
418
|
html_part = Mail::Part.new do
|
|
428
419
|
content_type 'text/html; charset=UTF-8'
|
|
429
420
|
body '<h1>This is HTML</h1>'
|
|
430
421
|
end
|
|
431
|
-
|
|
422
|
+
|
|
432
423
|
mail.text_part = text_part
|
|
433
424
|
mail.html_part = html_part
|
|
434
425
|
|
|
@@ -437,14 +428,14 @@ Results in the same email as done using the block form
|
|
|
437
428
|
=== Getting error reports from an email:
|
|
438
429
|
|
|
439
430
|
require 'mail'
|
|
440
|
-
|
|
431
|
+
|
|
441
432
|
@mail = Mail.read('/path/to/bounce_message.eml')
|
|
442
|
-
|
|
433
|
+
|
|
443
434
|
@mail.bounced? #=> true
|
|
444
435
|
@mail.final_recipient #=> rfc822;mikel@dont.exist.com
|
|
445
436
|
@mail.action #=> failed
|
|
446
437
|
@mail.error_status #=> 5.5.0
|
|
447
|
-
@mail.diagnostic_code #=> smtp;550 Requested action not taken: mailbox unavailable
|
|
438
|
+
@mail.diagnostic_code #=> smtp;550 Requested action not taken: mailbox unavailable
|
|
448
439
|
@mail.retryable? #=> false
|
|
449
440
|
|
|
450
441
|
=== Attaching and Detaching Files
|
|
@@ -453,7 +444,7 @@ Results in the same email as done using the block form
|
|
|
453
444
|
|
|
454
445
|
You can just read the file off an absolute path, Mail will try
|
|
455
446
|
to guess the mime_type and will encode the file in Base64 for you.
|
|
456
|
-
|
|
447
|
+
|
|
457
448
|
@mail = Mail.new
|
|
458
449
|
@mail.add_file("/path/to/file.jpg")
|
|
459
450
|
@mail.parts.first.attachment? #=> true
|
|
@@ -464,7 +455,7 @@ to guess the mime_type and will encode the file in Base64 for you.
|
|
|
464
455
|
|
|
465
456
|
Or You can pass in file_data and give it a filename, again, mail
|
|
466
457
|
will try and guess the mime_type for you.
|
|
467
|
-
|
|
458
|
+
|
|
468
459
|
@mail = Mail.new
|
|
469
460
|
@mail.attachments['myfile.pdf'] = File.read('path/to/myfile.pdf')
|
|
470
461
|
@mail.parts.first.attachment? #=> true
|
|
@@ -497,7 +488,7 @@ Of course... Mail will round trip an attachment as well
|
|
|
497
488
|
end
|
|
498
489
|
|
|
499
490
|
@round_tripped_mail = Mail.new(@mail.encoded)
|
|
500
|
-
|
|
491
|
+
|
|
501
492
|
@round_tripped_mail.attachments.length #=> 1
|
|
502
493
|
@round_tripped_mail.attachments.first.filename #=> 'myfile.pdf'
|
|
503
494
|
|
|
@@ -530,9 +521,9 @@ sending emails, the TestMailer can do this for you.
|
|
|
530
521
|
|
|
531
522
|
== Excerpts from TREC Spam Corpus 2005
|
|
532
523
|
|
|
533
|
-
The spec fixture files in spec/fixtures/emails/from_trec_2005 are from the
|
|
524
|
+
The spec fixture files in spec/fixtures/emails/from_trec_2005 are from the
|
|
534
525
|
2005 TREC Public Spam Corpus. They remain copyrighted under the terms of
|
|
535
|
-
that project and license agreement. They are used in this project to verify
|
|
526
|
+
that project and license agreement. They are used in this project to verify
|
|
536
527
|
and describe the development of this email parser implementation.
|
|
537
528
|
|
|
538
529
|
http://plg.uwaterloo.ca/~gvcormac/treccorpus/
|
|
@@ -543,14 +534,14 @@ They are used as allowed by 'Permitted Uses, Clause 3':
|
|
|
543
534
|
or published in a scientific or technical context, solely for
|
|
544
535
|
the purpose of describing the research and development and
|
|
545
536
|
related issues."
|
|
546
|
-
|
|
537
|
+
|
|
547
538
|
-- http://plg.uwaterloo.ca/~gvcormac/treccorpus/
|
|
548
539
|
|
|
549
540
|
== License:
|
|
550
541
|
|
|
551
542
|
(The MIT License)
|
|
552
543
|
|
|
553
|
-
Copyright (c) 2009
|
|
544
|
+
Copyright (c) 2009, 2010, 2011
|
|
554
545
|
|
|
555
546
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
556
547
|
a copy of this software and associated documentation files (the
|
data/Rakefile
CHANGED
|
@@ -1,9 +1,29 @@
|
|
|
1
|
+
begin
|
|
2
|
+
require "rubygems"
|
|
3
|
+
require "bundler"
|
|
4
|
+
rescue LoadError
|
|
5
|
+
raise "Could not load the bundler gem. Install it with `gem install bundler`."
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
if Gem::Version.new(Bundler::VERSION) <= Gem::Version.new("1.0.0")
|
|
9
|
+
raise RuntimeError, "Your bundler version is too old for Mail" +
|
|
10
|
+
"Run `gem install bundler` to upgrade."
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
begin
|
|
14
|
+
# Set up load paths for all bundled gems
|
|
15
|
+
ENV["BUNDLE_GEMFILE"] = File.expand_path("../Gemfile", __FILE__)
|
|
16
|
+
Bundler.setup
|
|
17
|
+
rescue Bundler::GemNotFound
|
|
18
|
+
raise RuntimeError, "Bundler couldn't find some gems." +
|
|
19
|
+
"Did you run `bundle install`?"
|
|
20
|
+
end
|
|
21
|
+
|
|
1
22
|
require File.expand_path('../spec/environment', __FILE__)
|
|
2
23
|
|
|
3
24
|
require 'rake/rdoctask'
|
|
4
25
|
require 'rake/testtask'
|
|
5
26
|
require 'spec/rake/spectask'
|
|
6
|
-
require 'cucumber/rake/task'
|
|
7
27
|
|
|
8
28
|
desc "Build a gem file"
|
|
9
29
|
task :build do
|
|
@@ -11,9 +31,6 @@ task :build do
|
|
|
11
31
|
end
|
|
12
32
|
|
|
13
33
|
task :default => :spec
|
|
14
|
-
Cucumber::Rake::Task.new do |t|
|
|
15
|
-
t.cucumber_opts = "spec/features --format pretty"
|
|
16
|
-
end
|
|
17
34
|
|
|
18
35
|
Spec::Rake::SpecTask.new(:rcov) do |t|
|
|
19
36
|
t.spec_files = FileList['test/**/tc_*.rb', 'spec/**/*_spec.rb']
|
|
@@ -31,10 +48,18 @@ end
|
|
|
31
48
|
|
|
32
49
|
Rake::RDocTask.new(:rdoc) do |rdoc|
|
|
33
50
|
rdoc.rdoc_dir = 'rdoc'
|
|
34
|
-
rdoc.title = 'Mail'
|
|
35
|
-
|
|
51
|
+
rdoc.title = 'Mail - A Ruby Mail Library'
|
|
52
|
+
|
|
53
|
+
rdoc.options << '-c' << 'utf-8'
|
|
54
|
+
rdoc.options << '--line-numbers'
|
|
55
|
+
rdoc.options << '--inline-source'
|
|
56
|
+
rdoc.options << '-m' << 'README.rdoc'
|
|
57
|
+
|
|
36
58
|
rdoc.rdoc_files.include('README.rdoc')
|
|
37
59
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
|
60
|
+
rdoc.rdoc_files.include('lib/network/**/*.rb')
|
|
61
|
+
rdoc.rdoc_files.exclude('lib/parsers/*')
|
|
62
|
+
|
|
38
63
|
end
|
|
39
64
|
|
|
40
65
|
# load custom rake tasks
|
data/lib/VERSION
CHANGED
|
@@ -37,9 +37,10 @@ module Mail
|
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
def []=(name, value)
|
|
40
|
-
|
|
40
|
+
encoded_name = Mail::Encodings.decode_encode name, :encode
|
|
41
|
+
default_values = { :content_type => "#{set_mime_type(name)}; filename=\"#{encoded_name}\"",
|
|
41
42
|
:content_transfer_encoding => "#{guess_encoding}",
|
|
42
|
-
:content_disposition => "#{@content_disposition_type}; filename=\"#{
|
|
43
|
+
:content_disposition => "#{@content_disposition_type}; filename=\"#{encoded_name}\"" }
|
|
43
44
|
|
|
44
45
|
if value.is_a?(Hash)
|
|
45
46
|
|
|
@@ -73,7 +74,7 @@ module Mail
|
|
|
73
74
|
hash[:body].force_encoding("BINARY")
|
|
74
75
|
end
|
|
75
76
|
end
|
|
76
|
-
|
|
77
|
+
|
|
77
78
|
attachment = Part.new(hash)
|
|
78
79
|
attachment.add_content_id(hash[:content_id])
|
|
79
80
|
|
|
@@ -102,4 +103,3 @@ module Mail
|
|
|
102
103
|
|
|
103
104
|
end
|
|
104
105
|
end
|
|
105
|
-
|
data/lib/mail/body.rb
CHANGED
|
@@ -130,7 +130,6 @@ module Mail
|
|
|
130
130
|
@parts.sort!(@part_sort_order)
|
|
131
131
|
p.body.sort_parts!
|
|
132
132
|
end
|
|
133
|
-
# @parts.sort!(@part_sort_order)
|
|
134
133
|
end
|
|
135
134
|
|
|
136
135
|
# Returns the raw source that the body was initialized with, without
|
|
@@ -163,7 +162,12 @@ module Mail
|
|
|
163
162
|
else
|
|
164
163
|
# Decode then encode to normalize and allow transforming
|
|
165
164
|
# from base64 to Q-P and vice versa
|
|
166
|
-
|
|
165
|
+
decoded = dec.decode(raw_source)
|
|
166
|
+
if defined?(Encoding) && charset && charset != "US-ASCII"
|
|
167
|
+
decoded.encode!(charset)
|
|
168
|
+
decoded.force_encoding('BINARY') unless Encoding.find(charset).ascii_compatible?
|
|
169
|
+
end
|
|
170
|
+
enc.encode(decoded)
|
|
167
171
|
end
|
|
168
172
|
end
|
|
169
173
|
end
|