tmail_es 1.2.7.2
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.
- checksums.yaml +7 -0
- data/CHANGES +83 -0
- data/LICENSE +21 -0
- data/NOTES +7 -0
- data/README +182 -0
- data/Rakefile +2 -0
- data/ext/Makefile +20 -0
- data/ext/tmailscanner/tmail/MANIFEST +4 -0
- data/ext/tmailscanner/tmail/depend +1 -0
- data/ext/tmailscanner/tmail/extconf.rb +33 -0
- data/ext/tmailscanner/tmail/tmailscanner.c +614 -0
- data/lib/tmail/Makefile +18 -0
- data/lib/tmail/address.rb +392 -0
- data/lib/tmail/attachments.rb +65 -0
- data/lib/tmail/base64.rb +46 -0
- data/lib/tmail/compat.rb +41 -0
- data/lib/tmail/config.rb +67 -0
- data/lib/tmail/core_extensions.rb +63 -0
- data/lib/tmail/encode.rb +590 -0
- data/lib/tmail/header.rb +962 -0
- data/lib/tmail/index.rb +9 -0
- data/lib/tmail/interface.rb +1162 -0
- data/lib/tmail/loader.rb +3 -0
- data/lib/tmail/mail.rb +578 -0
- data/lib/tmail/mailbox.rb +496 -0
- data/lib/tmail/main.rb +6 -0
- data/lib/tmail/mbox.rb +3 -0
- data/lib/tmail/net.rb +250 -0
- data/lib/tmail/obsolete.rb +132 -0
- data/lib/tmail/parser.rb +1060 -0
- data/lib/tmail/parser.y +416 -0
- data/lib/tmail/port.rb +379 -0
- data/lib/tmail/quoting.rb +164 -0
- data/lib/tmail/require_arch.rb +58 -0
- data/lib/tmail/scanner.rb +49 -0
- data/lib/tmail/scanner_r.rb +261 -0
- data/lib/tmail/stringio.rb +280 -0
- data/lib/tmail/utils.rb +361 -0
- data/lib/tmail/vendor/rchardet-1.3/COPYING +504 -0
- data/lib/tmail/vendor/rchardet-1.3/README +12 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/big5freq.rb +927 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/big5prober.rb +42 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/chardistribution.rb +238 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/charsetgroupprober.rb +112 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/charsetprober.rb +75 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/codingstatemachine.rb +64 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/constants.rb +42 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/escprober.rb +89 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/escsm.rb +244 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/eucjpprober.rb +88 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/euckrfreq.rb +596 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/euckrprober.rb +42 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/euctwfreq.rb +430 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/euctwprober.rb +42 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/gb2312freq.rb +474 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/gb2312prober.rb +42 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/hebrewprober.rb +289 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/jisfreq.rb +570 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/jpcntx.rb +229 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/langbulgarianmodel.rb +229 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/langcyrillicmodel.rb +330 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/langgreekmodel.rb +227 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/langhebrewmodel.rb +202 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/langhungarianmodel.rb +226 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/langthaimodel.rb +201 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/latin1prober.rb +147 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/mbcharsetprober.rb +89 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/mbcsgroupprober.rb +45 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/mbcssm.rb +542 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/sbcharsetprober.rb +124 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/sbcsgroupprober.rb +56 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/sjisprober.rb +88 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/universaldetector.rb +167 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet/utf8prober.rb +87 -0
- data/lib/tmail/vendor/rchardet-1.3/lib/rchardet.rb +67 -0
- data/lib/tmail/version.rb +40 -0
- data/lib/tmail.rb +6 -0
- data/setup.rb +1482 -0
- data/test/extctrl.rb +6 -0
- data/test/fixtures/apple_unquoted_content_type +44 -0
- data/test/fixtures/inline_attachment.txt +2095 -0
- data/test/fixtures/iso_8859_1_email_without_encoding_and_message_id.txt +16 -0
- data/test/fixtures/mailbox +414 -0
- data/test/fixtures/mailbox.zip +0 -0
- data/test/fixtures/mailbox_without_any_from_or_sender +10 -0
- data/test/fixtures/mailbox_without_from +11 -0
- data/test/fixtures/mailbox_without_return_path +12 -0
- data/test/fixtures/marked_as_iso_8859_1_but_it_is_utf_8.txt +33 -0
- data/test/fixtures/marked_as_utf_8_but_it_is_iso_8859_1.txt +56 -0
- data/test/fixtures/raw_attack_email_with_zero_length_whitespace +29 -0
- data/test/fixtures/raw_base64_decoded_string +0 -0
- data/test/fixtures/raw_base64_email +83 -0
- data/test/fixtures/raw_base64_encoded_string +1 -0
- data/test/fixtures/raw_email +14 -0
- data/test/fixtures/raw_email10 +20 -0
- data/test/fixtures/raw_email11 +34 -0
- data/test/fixtures/raw_email12 +32 -0
- data/test/fixtures/raw_email13 +29 -0
- data/test/fixtures/raw_email2 +114 -0
- data/test/fixtures/raw_email3 +70 -0
- data/test/fixtures/raw_email4 +59 -0
- data/test/fixtures/raw_email5 +19 -0
- data/test/fixtures/raw_email6 +20 -0
- data/test/fixtures/raw_email7 +66 -0
- data/test/fixtures/raw_email8 +47 -0
- data/test/fixtures/raw_email9 +28 -0
- data/test/fixtures/raw_email_bad_time +62 -0
- data/test/fixtures/raw_email_double_at_in_header +14 -0
- data/test/fixtures/raw_email_multiple_from +30 -0
- data/test/fixtures/raw_email_only_attachment +17 -0
- data/test/fixtures/raw_email_quoted_with_0d0a +14 -0
- data/test/fixtures/raw_email_reply +32 -0
- data/test/fixtures/raw_email_simple +11 -0
- data/test/fixtures/raw_email_string_in_date_field +17 -0
- data/test/fixtures/raw_email_trailing_dot +21 -0
- data/test/fixtures/raw_email_with_bad_date +48 -0
- data/test/fixtures/raw_email_with_illegal_boundary +58 -0
- data/test/fixtures/raw_email_with_mimepart_without_content_type +94 -0
- data/test/fixtures/raw_email_with_multipart_mixed_quoted_boundary +50 -0
- data/test/fixtures/raw_email_with_nested_attachment +100 -0
- data/test/fixtures/raw_email_with_partially_quoted_subject +14 -0
- data/test/fixtures/raw_email_with_quoted_attachment_filename +60 -0
- data/test/fixtures/raw_email_with_quoted_illegal_boundary +58 -0
- data/test/fixtures/raw_email_with_wrong_splitted_multibyte_encoded_word_subject +15 -0
- data/test/fixtures/the_only_part_is_a_word_document.txt +425 -0
- data/test/fixtures/unquoted_filename_in_attachment +177 -0
- data/test/kcode.rb +14 -0
- data/test/temp_test_one.rb +46 -0
- data/test/test_address.rb +1216 -0
- data/test/test_attachments.rb +133 -0
- data/test/test_base64.rb +64 -0
- data/test/test_encode.rb +139 -0
- data/test/test_header.rb +1021 -0
- data/test/test_helper.rb +9 -0
- data/test/test_mail.rb +756 -0
- data/test/test_mbox.rb +184 -0
- data/test/test_port.rb +440 -0
- data/test/test_quote.rb +107 -0
- data/test/test_scanner.rb +209 -0
- data/test/test_utils.rb +36 -0
- data/tmail_es.gemspec +35 -0
- metadata +257 -0
data/lib/tmail/net.rb
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
#--
|
|
2
|
+
# Copyright (c) 1998-2003 Minero Aoki <aamine@loveruby.net>
|
|
3
|
+
#
|
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
|
5
|
+
# a copy of this software and associated documentation files (the
|
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
|
10
|
+
# the following conditions:
|
|
11
|
+
#
|
|
12
|
+
# The above copyright notice and this permission notice shall be
|
|
13
|
+
# included in all copies or substantial portions of the Software.
|
|
14
|
+
#
|
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
+
#
|
|
23
|
+
# Note: Originally licensed under LGPL v2+. Using MIT license for Rails
|
|
24
|
+
# with permission of Minero Aoki.
|
|
25
|
+
#++
|
|
26
|
+
|
|
27
|
+
#:stopdoc:
|
|
28
|
+
require 'nkf'
|
|
29
|
+
#:startdoc:
|
|
30
|
+
|
|
31
|
+
module TMail
|
|
32
|
+
|
|
33
|
+
class Mail
|
|
34
|
+
|
|
35
|
+
def send_to( smtp )
|
|
36
|
+
do_send_to(smtp) do
|
|
37
|
+
ready_to_send
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def send_text_to( smtp )
|
|
42
|
+
do_send_to(smtp) do
|
|
43
|
+
ready_to_send
|
|
44
|
+
mime_encode
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def do_send_to( smtp )
|
|
49
|
+
from = from_address or raise ArgumentError, 'no from address'
|
|
50
|
+
(dests = destinations).empty? and raise ArgumentError, 'no receipient'
|
|
51
|
+
yield
|
|
52
|
+
send_to_0 smtp, from, dests
|
|
53
|
+
end
|
|
54
|
+
private :do_send_to
|
|
55
|
+
|
|
56
|
+
def send_to_0( smtp, from, to )
|
|
57
|
+
smtp.ready(from, to) do |f|
|
|
58
|
+
encoded "\r\n", 'j', f, ''
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def ready_to_send
|
|
63
|
+
delete_no_send_fields
|
|
64
|
+
add_message_id
|
|
65
|
+
add_date
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
NOSEND_FIELDS = %w(
|
|
69
|
+
received
|
|
70
|
+
bcc
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
def delete_no_send_fields
|
|
74
|
+
NOSEND_FIELDS.each do |nm|
|
|
75
|
+
delete nm
|
|
76
|
+
end
|
|
77
|
+
delete_if {|n,v| v.empty? }
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
def add_message_id( fqdn = nil )
|
|
81
|
+
unless @message_id_enforced
|
|
82
|
+
self.message_id = ::TMail::new_message_id(fqdn)
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def add_date
|
|
87
|
+
self.date = Time.now
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def mime_encode
|
|
91
|
+
if parts.empty?
|
|
92
|
+
mime_encode_singlepart
|
|
93
|
+
else
|
|
94
|
+
mime_encode_multipart true
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def mime_encode_singlepart
|
|
99
|
+
self.mime_version = '1.0'
|
|
100
|
+
b = body
|
|
101
|
+
if NKF.guess(b) != NKF::BINARY
|
|
102
|
+
mime_encode_text b
|
|
103
|
+
else
|
|
104
|
+
mime_encode_binary b
|
|
105
|
+
end
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def mime_encode_text( body )
|
|
109
|
+
self.body = NKF.nkf('-j -m0', body)
|
|
110
|
+
self.set_content_type 'text', 'plain', {'charset' => 'iso-2022-jp'}
|
|
111
|
+
self.encoding = '7bit'
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
def mime_encode_binary( body )
|
|
115
|
+
self.body = [body].pack('m')
|
|
116
|
+
self.set_content_type 'application', 'octet-stream'
|
|
117
|
+
self.encoding = 'Base64'
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
def mime_encode_multipart( top = true )
|
|
121
|
+
self.mime_version = '1.0' if top
|
|
122
|
+
self.set_content_type 'multipart', 'mixed'
|
|
123
|
+
e = encoding(nil)
|
|
124
|
+
if e and not /\A(?:7bit|8bit|binary)\z/i === e
|
|
125
|
+
raise ArgumentError,
|
|
126
|
+
'using C.T.Encoding with multipart mail is not permitted'
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
#:stopdoc:
|
|
133
|
+
class DeleteFields
|
|
134
|
+
|
|
135
|
+
NOSEND_FIELDS = %w(
|
|
136
|
+
received
|
|
137
|
+
bcc
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
def initialize( nosend = nil, delempty = true )
|
|
141
|
+
@no_send_fields = nosend || NOSEND_FIELDS.dup
|
|
142
|
+
@delete_empty_fields = delempty
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
attr :no_send_fields
|
|
146
|
+
attr :delete_empty_fields, true
|
|
147
|
+
|
|
148
|
+
def exec( mail )
|
|
149
|
+
@no_send_fields.each do |nm|
|
|
150
|
+
delete nm
|
|
151
|
+
end
|
|
152
|
+
delete_if {|n,v| v.empty? } if @delete_empty_fields
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
end
|
|
156
|
+
#:startdoc:
|
|
157
|
+
|
|
158
|
+
#:stopdoc:
|
|
159
|
+
class AddMessageId
|
|
160
|
+
|
|
161
|
+
def initialize( fqdn = nil )
|
|
162
|
+
@fqdn = fqdn
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
attr :fqdn, true
|
|
166
|
+
|
|
167
|
+
def exec( mail )
|
|
168
|
+
mail.message_id = ::TMail::new_msgid(@fqdn)
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
end
|
|
172
|
+
#:startdoc:
|
|
173
|
+
|
|
174
|
+
#:stopdoc:
|
|
175
|
+
class AddDate
|
|
176
|
+
|
|
177
|
+
def exec( mail )
|
|
178
|
+
mail.date = Time.now
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
end
|
|
182
|
+
#:startdoc:
|
|
183
|
+
|
|
184
|
+
#:stopdoc:
|
|
185
|
+
class MimeEncodeAuto
|
|
186
|
+
|
|
187
|
+
def initialize( s = nil, m = nil )
|
|
188
|
+
@singlepart_composer = s || MimeEncodeSingle.new
|
|
189
|
+
@multipart_composer = m || MimeEncodeMulti.new
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
attr :singlepart_composer
|
|
193
|
+
attr :multipart_composer
|
|
194
|
+
|
|
195
|
+
def exec( mail )
|
|
196
|
+
if mail._builtin_multipart?
|
|
197
|
+
then @multipart_composer
|
|
198
|
+
else @singlepart_composer end.exec mail
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
end
|
|
202
|
+
#:startdoc:
|
|
203
|
+
|
|
204
|
+
#:stopdoc:
|
|
205
|
+
class MimeEncodeSingle
|
|
206
|
+
|
|
207
|
+
def exec( mail )
|
|
208
|
+
mail.mime_version = '1.0'
|
|
209
|
+
b = mail.body
|
|
210
|
+
if NKF.guess(b) != NKF::BINARY
|
|
211
|
+
on_text b
|
|
212
|
+
else
|
|
213
|
+
on_binary b
|
|
214
|
+
end
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
def on_text( body )
|
|
218
|
+
mail.body = NKF.nkf('-j -m0', body)
|
|
219
|
+
mail.set_content_type 'text', 'plain', {'charset' => 'iso-2022-jp'}
|
|
220
|
+
mail.encoding = '7bit'
|
|
221
|
+
end
|
|
222
|
+
|
|
223
|
+
def on_binary( body )
|
|
224
|
+
mail.body = [body].pack('m')
|
|
225
|
+
mail.set_content_type 'application', 'octet-stream'
|
|
226
|
+
mail.encoding = 'Base64'
|
|
227
|
+
end
|
|
228
|
+
|
|
229
|
+
end
|
|
230
|
+
#:startdoc:
|
|
231
|
+
|
|
232
|
+
#:stopdoc:
|
|
233
|
+
class MimeEncodeMulti
|
|
234
|
+
|
|
235
|
+
def exec( mail, top = true )
|
|
236
|
+
mail.mime_version = '1.0' if top
|
|
237
|
+
mail.set_content_type 'multipart', 'mixed'
|
|
238
|
+
e = encoding(nil)
|
|
239
|
+
if e and not /\A(?:7bit|8bit|binary)\z/i === e
|
|
240
|
+
raise ArgumentError,
|
|
241
|
+
'using C.T.Encoding with multipart mail is not permitted'
|
|
242
|
+
end
|
|
243
|
+
mail.parts.each do |m|
|
|
244
|
+
exec m, false if m._builtin_multipart?
|
|
245
|
+
end
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
end
|
|
249
|
+
#:startdoc:
|
|
250
|
+
end # module TMail
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
=begin rdoc
|
|
2
|
+
|
|
3
|
+
= Obsolete methods that are depriciated
|
|
4
|
+
|
|
5
|
+
If you really want to see them, go to lib/tmail/obsolete.rb and view to your
|
|
6
|
+
heart's content.
|
|
7
|
+
|
|
8
|
+
=end
|
|
9
|
+
#--
|
|
10
|
+
# Copyright (c) 1998-2003 Minero Aoki <aamine@loveruby.net>
|
|
11
|
+
#
|
|
12
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
|
13
|
+
# a copy of this software and associated documentation files (the
|
|
14
|
+
# "Software"), to deal in the Software without restriction, including
|
|
15
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
|
16
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
17
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
|
18
|
+
# the following conditions:
|
|
19
|
+
#
|
|
20
|
+
# The above copyright notice and this permission notice shall be
|
|
21
|
+
# included in all copies or substantial portions of the Software.
|
|
22
|
+
#
|
|
23
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
24
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
25
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
26
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
27
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
28
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
29
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
30
|
+
#
|
|
31
|
+
# Note: Originally licensed under LGPL v2+. Using MIT license for Rails
|
|
32
|
+
# with permission of Minero Aoki.
|
|
33
|
+
#++
|
|
34
|
+
#:stopdoc:
|
|
35
|
+
module TMail #:nodoc:
|
|
36
|
+
|
|
37
|
+
class Mail
|
|
38
|
+
alias include? key?
|
|
39
|
+
alias has_key? key?
|
|
40
|
+
|
|
41
|
+
def values
|
|
42
|
+
ret = []
|
|
43
|
+
each_field {|v| ret.push v }
|
|
44
|
+
ret
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def value?( val )
|
|
48
|
+
HeaderField === val or return false
|
|
49
|
+
|
|
50
|
+
[ @header[val.name.downcase] ].flatten.include? val
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
alias has_value? value?
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
class Mail
|
|
57
|
+
def from_addr( default = nil )
|
|
58
|
+
addr, = from_addrs(nil)
|
|
59
|
+
addr || default
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def from_address( default = nil )
|
|
63
|
+
if a = from_addr(nil)
|
|
64
|
+
a.spec
|
|
65
|
+
else
|
|
66
|
+
default
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
alias from_address= from_addrs=
|
|
71
|
+
|
|
72
|
+
def from_phrase( default = nil )
|
|
73
|
+
if a = from_addr(nil)
|
|
74
|
+
a.phrase
|
|
75
|
+
else
|
|
76
|
+
default
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
alias msgid message_id
|
|
81
|
+
alias msgid= message_id=
|
|
82
|
+
|
|
83
|
+
alias each_dest each_destination
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
class Address
|
|
87
|
+
alias route routes
|
|
88
|
+
alias addr spec
|
|
89
|
+
|
|
90
|
+
def spec=( str )
|
|
91
|
+
@local, @domain = str.split(/@/,2).map {|s| s.split(/\./) }
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
alias addr= spec=
|
|
95
|
+
alias address= spec=
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
class MhMailbox
|
|
99
|
+
alias new_mail new_port
|
|
100
|
+
alias each_mail each_port
|
|
101
|
+
alias each_newmail each_new_port
|
|
102
|
+
end
|
|
103
|
+
class UNIXMbox
|
|
104
|
+
alias new_mail new_port
|
|
105
|
+
alias each_mail each_port
|
|
106
|
+
alias each_newmail each_new_port
|
|
107
|
+
end
|
|
108
|
+
class Maildir
|
|
109
|
+
alias new_mail new_port
|
|
110
|
+
alias each_mail each_port
|
|
111
|
+
alias each_newmail each_new_port
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
extend TextUtils
|
|
115
|
+
|
|
116
|
+
class << self
|
|
117
|
+
alias msgid? message_id?
|
|
118
|
+
alias boundary new_boundary
|
|
119
|
+
alias msgid new_message_id
|
|
120
|
+
alias new_msgid new_message_id
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def Mail.boundary
|
|
124
|
+
::TMail.new_boundary
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def Mail.msgid
|
|
128
|
+
::TMail.new_message_id
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
end # module TMail
|
|
132
|
+
#:startdoc:
|