tmail 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +5 -0
- data/NOTES +84 -0
- data/README +6 -1
- data/ext/Makefile +20 -0
- data/ext/{tmail/base64 → mailscanner/tmail}/MANIFEST +1 -1
- data/ext/mailscanner/tmail/depend +1 -0
- data/ext/mailscanner/tmail/extconf.rb +24 -0
- data/ext/{tmail/scanner_c/scanner_c.c → mailscanner/tmail/mailscanner.c} +8 -7
- data/lib/tmail/base64.rb +29 -52
- data/lib/tmail/encode.rb +37 -38
- data/lib/tmail/interface.rb +632 -49
- data/lib/tmail/main.rb +4 -0
- data/lib/tmail/net.rb +0 -35
- data/lib/tmail/quoting.rb +8 -8
- data/lib/tmail/scanner.rb +10 -6
- data/lib/tmail/scanner_r.rb +3 -5
- data/lib/tmail/version.rb +2 -2
- data/log/ChangeLog.txt +1131 -0
- data/log/History.txt +40 -0
- data/log/Todo.txt +32 -0
- data/meta/MANIFEST +118 -0
- data/meta/ROLLRC +3 -0
- data/meta/icli.yaml +2 -2
- data/meta/{tmail-1.1.1.roll → project.yaml} +3 -7
- data/sample/bench_base64.rb +48 -0
- data/{bat → script}/changelog +0 -0
- data/script/clobber/distclean +8 -0
- data/{bat → script}/clobber/package +0 -0
- data/script/compile +32 -0
- data/{bat → script}/config.yaml +2 -2
- data/{bat → script}/prepare +4 -2
- data/{bat → script}/publish +0 -0
- data/{bat → script}/release +0 -0
- data/{bat → script}/setup +0 -0
- data/{bat → script}/stats +0 -0
- data/{bat → script}/tag +0 -0
- data/script/test +36 -0
- data/test/fixtures/raw_email_reply +32 -0
- data/test/fixtures/raw_email_with_bad_date +48 -0
- data/test/test_address.rb +1 -3
- data/test/test_attachments.rb +1 -2
- data/test/test_base64.rb +3 -2
- data/test/test_encode.rb +1 -0
- data/test/test_header.rb +2 -3
- data/test/test_helper.rb +8 -2
- data/test/test_mail.rb +45 -16
- data/test/test_mbox.rb +1 -1
- data/test/test_port.rb +1 -1
- data/test/test_scanner.rb +1 -1
- data/test/test_utils.rb +1 -2
- metadata +82 -76
- data/bat/compile +0 -42
- data/bat/rdoc +0 -42
- data/bat/test +0 -25
- data/ext/tmail/Makefile +0 -25
- data/ext/tmail/base64/base64.c +0 -264
- data/ext/tmail/base64/depend +0 -1
- data/ext/tmail/base64/extconf.rb +0 -38
- data/ext/tmail/scanner_c/MANIFEST +0 -4
- data/ext/tmail/scanner_c/depend +0 -1
- data/ext/tmail/scanner_c/extconf.rb +0 -38
- data/lib/tmail/tmail.rb +0 -1
data/test/test_address.rb
CHANGED
data/test/test_attachments.rb
CHANGED
data/test/test_base64.rb
CHANGED
@@ -1,12 +1,13 @@
|
|
1
|
+
require 'test_helper'
|
1
2
|
require 'tmail/base64'
|
2
3
|
require 'test/unit'
|
3
4
|
|
4
5
|
class TestTMailBase64 < Test::Unit::TestCase
|
5
6
|
def try(orig)
|
6
7
|
ok = [orig].pack('m').delete("\r\n")
|
7
|
-
result = TMail::Base64.
|
8
|
+
result = TMail::Base64.encode(orig)
|
8
9
|
assert_equal ok, result, "str=#{orig.inspect}"
|
9
|
-
assert_equal orig, TMail::Base64.
|
10
|
+
assert_equal orig, TMail::Base64.decode(result), "str=#{orig.inspect}"
|
10
11
|
end
|
11
12
|
|
12
13
|
def test_normal
|
data/test/test_encode.rb
CHANGED
data/test/test_header.rb
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
$:.unshift File.dirname(__FILE__)
|
2
|
+
require 'test_helper'
|
2
3
|
require 'tmail'
|
3
4
|
require 'tmail/header'
|
4
5
|
require 'kcode'
|
5
|
-
require 'extctrl'
|
6
|
-
require 'test/unit'
|
7
6
|
require 'time'
|
8
|
-
require 'test_helper'
|
9
7
|
|
10
8
|
class UnstructuredHeaderTester < Test::Unit::TestCase
|
11
9
|
def test_s_new
|
@@ -420,6 +418,7 @@ Received: by mebius with Microsoft Mail
|
|
420
418
|
=end
|
421
419
|
|
422
420
|
# word + domain-literal in FROM
|
421
|
+
|
423
422
|
h = TMail::HeaderField.new('Received',
|
424
423
|
'from localhost [192.168.1.1]; Sat, 19 Dec 1998 22:19:50 PST')
|
425
424
|
assert_equal 'localhost', h.from
|
data/test/test_helper.rb
CHANGED
@@ -1,2 +1,8 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# Add in the local library for the load path so we get that before any possible
|
2
|
+
# gem that is already installed.
|
3
|
+
$:.unshift File.dirname(__FILE__) + "/../lib"
|
4
|
+
$:.unshift File.dirname(__FILE__) + "/../lib/tmail"
|
5
|
+
require 'test/unit'
|
6
|
+
require 'extctrl'
|
7
|
+
require 'test/unit'
|
8
|
+
require 'tmail'
|
data/test/test_mail.rb
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
$:.unshift File.dirname(__FILE__)
|
2
|
+
require 'test_helper'
|
2
3
|
require 'tmail'
|
3
4
|
require 'kcode'
|
4
|
-
require 'extctrl'
|
5
|
-
require 'test/unit'
|
6
5
|
require 'time'
|
7
|
-
require 'test_helper'
|
8
6
|
|
9
7
|
class TestMail < Test::Unit::TestCase
|
10
8
|
include TMail::TextUtils
|
@@ -292,6 +290,28 @@ EOS
|
|
292
290
|
assert_equal nil, @mail.reply_to
|
293
291
|
assert_equal 'DEFAULT VALUE', @mail.reply_to('DEFAULT VALUE')
|
294
292
|
end
|
293
|
+
|
294
|
+
def test_reply_to_with_blank_reply_to
|
295
|
+
@mail = TMail::Mail.new
|
296
|
+
from_addr = TMail::Address.parse("Mikel Lindsaar <mikel@lindsaar.net>")
|
297
|
+
@mail.from = from_addr
|
298
|
+
|
299
|
+
# No reply_to set, should return from address
|
300
|
+
assert_equal([from_addr], @mail.reply_addresses)
|
301
|
+
|
302
|
+
# reply_to and from set, should return reply_to
|
303
|
+
reply_addr = TMail::Address.parse("Bob <bob@you.net>")
|
304
|
+
@mail.reply_to = reply_addr
|
305
|
+
assert_equal([reply_addr], @mail.reply_addresses)
|
306
|
+
|
307
|
+
# reply_to set but nil, should return from address
|
308
|
+
@mail.reply_to = nil
|
309
|
+
assert_equal([from_addr], @mail.reply_addresses)
|
310
|
+
|
311
|
+
# from and reply_to set, but nil, should return empty array
|
312
|
+
@mail.from = nil
|
313
|
+
assert_equal([], @mail.reply_addresses)
|
314
|
+
end
|
295
315
|
|
296
316
|
def do_test_address_attr( name )
|
297
317
|
addr = 'Minero Aoki <aamine@loveruby.net>'
|
@@ -571,8 +591,7 @@ EOF
|
|
571
591
|
end
|
572
592
|
|
573
593
|
def test_nested_attachments_are_recognized_correctly
|
574
|
-
|
575
|
-
mail = TMail::Mail.parse(fixture)
|
594
|
+
mail = TMail::Mail.load("#{File.dirname(__FILE__)}/fixtures/raw_email_with_nested_attachment")
|
576
595
|
assert_equal 2, mail.attachments.length
|
577
596
|
assert_equal "image/png", mail.attachments.first.content_type
|
578
597
|
assert_equal 1902, mail.attachments.first.length
|
@@ -580,44 +599,54 @@ EOF
|
|
580
599
|
end
|
581
600
|
|
582
601
|
def test_decode_attachment_without_charset
|
583
|
-
|
584
|
-
mail = TMail::Mail.parse(fixture)
|
602
|
+
mail = TMail::Mail.load("#{File.dirname(__FILE__)}/fixtures/raw_email3")
|
585
603
|
attachment = mail.attachments.last
|
586
604
|
assert_equal 1026, attachment.read.length
|
587
605
|
end
|
588
606
|
|
589
607
|
def test_decode_message_without_content_type
|
590
|
-
|
591
|
-
mail = TMail::Mail.parse(fixture)
|
608
|
+
mail = TMail::Mail.load("#{File.dirname(__FILE__)}/fixtures/raw_email4")
|
592
609
|
assert_nothing_raised { mail.body }
|
593
610
|
end
|
594
611
|
|
595
612
|
def test_quoting_of_illegal_boundary_when_doing_mail_to_s
|
596
|
-
|
597
|
-
mail = TMail::Mail.parse(fixture)
|
613
|
+
mail = TMail::Mail.load("#{File.dirname(__FILE__)}/fixtures/raw_email_with_illegal_boundary")
|
598
614
|
assert_equal(true, mail.multipart?)
|
599
615
|
assert_equal('multipart/alternative; boundary="----=_NextPart_000_0093_01C81419.EB75E850"', mail['content-type'].to_s)
|
600
616
|
end
|
601
617
|
|
602
618
|
def test_quoted_illegal_boundary_when_doing_mail_to_s
|
603
|
-
|
604
|
-
mail = TMail::Mail.parse(fixture)
|
619
|
+
mail = TMail::Mail.load("#{File.dirname(__FILE__)}/fixtures/raw_email_with_quoted_illegal_boundary")
|
605
620
|
assert_equal(true, mail.multipart?)
|
606
621
|
assert_equal('multipart/alternative; boundary="----=_NextPart_000_0093_01C81419.EB75E850"', mail['content-type'].to_s)
|
607
622
|
end
|
608
623
|
|
609
624
|
def test_quoted_illegal_boundary_with_multipart_mixed_when_doing_mail_to_s
|
610
|
-
|
611
|
-
mail = TMail::Mail.parse(fixture)
|
625
|
+
mail = TMail::Mail.load("#{File.dirname(__FILE__)}/fixtures/raw_email_with_multipart_mixed_quoted_boundary")
|
612
626
|
assert_equal(true, mail.multipart?)
|
613
627
|
assert_equal('multipart/mixed; boundary="----=_Part_2192_32400445.1115745999735"', mail['content-type'].to_s)
|
614
628
|
end
|
615
629
|
|
616
630
|
def test_when_opening_a_base64_encoded_email_and_re_parsing_it_keeps_the_transfer_encoding_correct
|
617
|
-
mail = TMail::Mail.load(File.dirname(__FILE__)
|
631
|
+
mail = TMail::Mail.load("#{File.dirname(__FILE__)}/fixtures/raw_base64_email")
|
618
632
|
assert_equal("Base64", mail['Content-Transfer-Encoding'].to_s)
|
619
633
|
decoded_mail = TMail::Mail.parse(mail.to_s)
|
620
634
|
assert_equal("Base64", decoded_mail['Content-Transfer-Encoding'].to_s)
|
621
635
|
end
|
622
636
|
|
637
|
+
def test_create_reply
|
638
|
+
mail = TMail::Mail.load("#{File.dirname(__FILE__)}/fixtures/raw_email")
|
639
|
+
reply = mail.create_reply
|
640
|
+
assert_equal(["<d3b8cf8e49f04480850c28713a1f473e@37signals.com>"], reply.in_reply_to)
|
641
|
+
assert_equal(["<d3b8cf8e49f04480850c28713a1f473e@37signals.com>"], reply.references)
|
642
|
+
assert_equal(TMail::Mail, mail.create_reply.class)
|
643
|
+
end
|
644
|
+
|
645
|
+
def test_create_forward
|
646
|
+
mail = TMail::Mail.load("#{File.dirname(__FILE__)}/fixtures/raw_email")
|
647
|
+
forward = mail.create_forward
|
648
|
+
assert_equal(true, forward.multipart?)
|
649
|
+
assert_equal(TMail::Mail, forward.class)
|
650
|
+
end
|
651
|
+
|
623
652
|
end
|
data/test/test_mbox.rb
CHANGED
data/test/test_port.rb
CHANGED
data/test/test_scanner.rb
CHANGED
data/test/test_utils.rb
CHANGED
metadata
CHANGED
@@ -1,74 +1,38 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.4.6
|
3
|
-
specification_version: 2
|
4
2
|
name: tmail
|
5
3
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
- lib
|
11
|
-
email: tmail-talk@rubyforge.org
|
12
|
-
homepage:
|
13
|
-
rubyforge_project:
|
14
|
-
description: TMail is a Ruby-based mail handler. It allows you to compose stadards compliant emails in a very Ruby-way.
|
4
|
+
version: 1.2.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
-
|
15
8
|
autorequire:
|
16
|
-
default_executable:
|
17
9
|
bindir: bin
|
18
|
-
has_rdoc:
|
19
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">="
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: "0"
|
24
|
-
version:
|
25
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
26
|
-
requirements:
|
27
|
-
- - ">="
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: "0"
|
30
|
-
version:
|
31
|
-
platform: ruby
|
32
|
-
signing_key:
|
33
10
|
cert_chain: []
|
34
11
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
12
|
+
date: 2007-12-02 00:00:00 +11:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: TMail is a Ruby-based mail handler. It allows you to compose stadards compliant emails in a very Ruby-way.
|
17
|
+
email: tmail-talk@rubyforge.org
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files: []
|
23
|
+
|
39
24
|
files:
|
40
|
-
-
|
41
|
-
- README
|
42
|
-
- bat
|
43
|
-
- bat/changelog
|
44
|
-
- bat/clobber
|
45
|
-
- bat/clobber/package
|
46
|
-
- bat/compile
|
47
|
-
- bat/config.yaml
|
48
|
-
- bat/prepare
|
49
|
-
- bat/publish
|
50
|
-
- bat/rdoc
|
51
|
-
- bat/release
|
52
|
-
- bat/setup
|
53
|
-
- bat/stats
|
54
|
-
- bat/tag
|
55
|
-
- bat/test
|
25
|
+
- CHANGES
|
56
26
|
- ext
|
57
|
-
- ext/
|
58
|
-
- ext/tmail
|
59
|
-
- ext/tmail/
|
60
|
-
- ext/tmail/
|
61
|
-
- ext/tmail/
|
62
|
-
- ext/tmail/
|
63
|
-
- ext/
|
64
|
-
- ext/tmail/scanner_c
|
65
|
-
- ext/tmail/scanner_c/MANIFEST
|
66
|
-
- ext/tmail/scanner_c/depend
|
67
|
-
- ext/tmail/scanner_c/extconf.rb
|
68
|
-
- ext/tmail/scanner_c/scanner_c.c
|
27
|
+
- ext/mailscanner
|
28
|
+
- ext/mailscanner/tmail
|
29
|
+
- ext/mailscanner/tmail/depend
|
30
|
+
- ext/mailscanner/tmail/extconf.rb
|
31
|
+
- ext/mailscanner/tmail/mailscanner.c
|
32
|
+
- ext/mailscanner/tmail/MANIFEST
|
33
|
+
- ext/Makefile
|
69
34
|
- lib
|
70
35
|
- lib/tmail
|
71
|
-
- lib/tmail/Makefile
|
72
36
|
- lib/tmail/address.rb
|
73
37
|
- lib/tmail/attachments.rb
|
74
38
|
- lib/tmail/base64.rb
|
@@ -82,8 +46,9 @@ files:
|
|
82
46
|
- lib/tmail/loader.rb
|
83
47
|
- lib/tmail/mail.rb
|
84
48
|
- lib/tmail/mailbox.rb
|
49
|
+
- lib/tmail/main.rb
|
50
|
+
- lib/tmail/Makefile
|
85
51
|
- lib/tmail/mbox.rb
|
86
|
-
- lib/tmail/mswin32
|
87
52
|
- lib/tmail/net.rb
|
88
53
|
- lib/tmail/obsolete.rb
|
89
54
|
- lib/tmail/parser.rb
|
@@ -94,14 +59,23 @@ files:
|
|
94
59
|
- lib/tmail/scanner.rb
|
95
60
|
- lib/tmail/scanner_r.rb
|
96
61
|
- lib/tmail/stringio.rb
|
97
|
-
- lib/tmail/tmail.rb
|
98
62
|
- lib/tmail/utils.rb
|
99
63
|
- lib/tmail/version.rb
|
100
64
|
- lib/tmail.rb
|
65
|
+
- LICENSE
|
66
|
+
- log
|
67
|
+
- log/ChangeLog.txt
|
68
|
+
- log/History.txt
|
69
|
+
- log/Todo.txt
|
101
70
|
- meta
|
102
71
|
- meta/icli.yaml
|
103
|
-
- meta/
|
72
|
+
- meta/MANIFEST
|
73
|
+
- meta/project.yaml
|
74
|
+
- meta/ROLLRC
|
75
|
+
- NOTES
|
76
|
+
- README
|
104
77
|
- sample
|
78
|
+
- sample/bench_base64.rb
|
105
79
|
- sample/data
|
106
80
|
- sample/data/multipart
|
107
81
|
- sample/data/normal
|
@@ -114,6 +88,20 @@ files:
|
|
114
88
|
- sample/parse-bench.rb
|
115
89
|
- sample/parse-test.rb
|
116
90
|
- sample/sendmail.rb
|
91
|
+
- script
|
92
|
+
- script/changelog
|
93
|
+
- script/clobber
|
94
|
+
- script/clobber/distclean
|
95
|
+
- script/clobber/package
|
96
|
+
- script/compile
|
97
|
+
- script/config.yaml
|
98
|
+
- script/prepare
|
99
|
+
- script/publish
|
100
|
+
- script/release
|
101
|
+
- script/setup
|
102
|
+
- script/stats
|
103
|
+
- script/tag
|
104
|
+
- script/test
|
117
105
|
- test
|
118
106
|
- test/extctrl.rb
|
119
107
|
- test/fixtures
|
@@ -134,7 +122,9 @@ files:
|
|
134
122
|
- test/fixtures/raw_email8
|
135
123
|
- test/fixtures/raw_email9
|
136
124
|
- test/fixtures/raw_email_quoted_with_0d0a
|
125
|
+
- test/fixtures/raw_email_reply
|
137
126
|
- test/fixtures/raw_email_simple
|
127
|
+
- test/fixtures/raw_email_with_bad_date
|
138
128
|
- test/fixtures/raw_email_with_illegal_boundary
|
139
129
|
- test/fixtures/raw_email_with_multipart_mixed_quoted_boundary
|
140
130
|
- test/fixtures/raw_email_with_nested_attachment
|
@@ -152,6 +142,33 @@ files:
|
|
152
142
|
- test/test_port.rb
|
153
143
|
- test/test_scanner.rb
|
154
144
|
- test/test_utils.rb
|
145
|
+
has_rdoc:
|
146
|
+
homepage:
|
147
|
+
post_install_message:
|
148
|
+
rdoc_options: []
|
149
|
+
|
150
|
+
require_paths:
|
151
|
+
- lib
|
152
|
+
- ext/tmail
|
153
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
154
|
+
requirements:
|
155
|
+
- - ">="
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: "0"
|
158
|
+
version:
|
159
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
160
|
+
requirements:
|
161
|
+
- - ">="
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
version: "0"
|
164
|
+
version:
|
165
|
+
requirements: []
|
166
|
+
|
167
|
+
rubyforge_project:
|
168
|
+
rubygems_version: 0.9.5
|
169
|
+
signing_key:
|
170
|
+
specification_version: 2
|
171
|
+
summary: Ruby Mail Handler
|
155
172
|
test_files:
|
156
173
|
- test/extctrl.rb
|
157
174
|
- test/fixtures
|
@@ -172,7 +189,9 @@ test_files:
|
|
172
189
|
- test/fixtures/raw_email8
|
173
190
|
- test/fixtures/raw_email9
|
174
191
|
- test/fixtures/raw_email_quoted_with_0d0a
|
192
|
+
- test/fixtures/raw_email_reply
|
175
193
|
- test/fixtures/raw_email_simple
|
194
|
+
- test/fixtures/raw_email_with_bad_date
|
176
195
|
- test/fixtures/raw_email_with_illegal_boundary
|
177
196
|
- test/fixtures/raw_email_with_multipart_mixed_quoted_boundary
|
178
197
|
- test/fixtures/raw_email_with_nested_attachment
|
@@ -190,16 +209,3 @@ test_files:
|
|
190
209
|
- test/test_port.rb
|
191
210
|
- test/test_scanner.rb
|
192
211
|
- test/test_utils.rb
|
193
|
-
rdoc_options: []
|
194
|
-
|
195
|
-
extra_rdoc_files: []
|
196
|
-
|
197
|
-
executables: []
|
198
|
-
|
199
|
-
extensions:
|
200
|
-
- ./ext/tmail/base64/extconf.rb
|
201
|
-
- ./ext/tmail/scanner_c/extconf.rb
|
202
|
-
requirements: []
|
203
|
-
|
204
|
-
dependencies: []
|
205
|
-
|