valodzka-tmail 1.2.3.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +74 -0
- data/LICENSE +21 -0
- data/NOTES +7 -0
- data/README +169 -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 +583 -0
- data/lib/tmail/Makefile +18 -0
- data/lib/tmail/address.rb +392 -0
- data/lib/tmail/attachments.rb +46 -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 +960 -0
- data/lib/tmail/index.rb +9 -0
- data/lib/tmail/interface.rb +1152 -0
- data/lib/tmail/loader.rb +3 -0
- data/lib/tmail/mail.rb +582 -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 +125 -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 +337 -0
- data/lib/tmail/version.rb +39 -0
- data/lib/tmail.rb +5 -0
- data/log/BugTrackingLog.txt +1245 -0
- data/log/Changelog.txt +534 -0
- data/log/Testlog.txt +2340 -0
- data/log/Todo.txt +30 -0
- data/meta/MANIFEST +128 -0
- data/meta/VERSION +1 -0
- data/meta/project.yaml +30 -0
- data/meta/unixname +1 -0
- data/sample/bench_base64.rb +48 -0
- data/sample/data/multipart +23 -0
- data/sample/data/normal +29 -0
- data/sample/data/sendtest +5 -0
- data/sample/data/simple +14 -0
- data/sample/data/test +27 -0
- data/sample/extract-attachements.rb +33 -0
- data/sample/from-check.rb +26 -0
- data/sample/multipart.rb +26 -0
- data/sample/parse-bench.rb +68 -0
- data/sample/parse-test.rb +19 -0
- data/sample/sendmail.rb +94 -0
- data/setup.rb +1482 -0
- data/site/contributing/index.html +183 -0
- data/site/css/clean.css +27 -0
- data/site/css/layout.css +31 -0
- data/site/css/style.css +60 -0
- data/site/download/index.html +61 -0
- data/site/img/envelope.jpg +0 -0
- data/site/img/mailman.gif +0 -0
- data/site/img/stamp-sm.jpg +0 -0
- data/site/img/stamp.jpg +0 -0
- data/site/img/stampborder.jpg +0 -0
- data/site/img/tfire.jpg +0 -0
- data/site/img/tmail.png +0 -0
- data/site/index.html +270 -0
- data/site/js/jquery.js +31 -0
- data/site/log/Changelog.xsl +33 -0
- data/site/log/changelog.xml +1677 -0
- data/site/outdated/BUGS +3 -0
- data/site/outdated/DEPENDS +1 -0
- data/site/outdated/Incompatibilities +89 -0
- data/site/outdated/Incompatibilities.ja +102 -0
- data/site/outdated/NEWS +9 -0
- data/site/outdated/README.ja +73 -0
- data/site/outdated/doc.ja/address.html +275 -0
- data/site/outdated/doc.ja/basics.html +405 -0
- data/site/outdated/doc.ja/config.html +49 -0
- data/site/outdated/doc.ja/details.html +146 -0
- data/site/outdated/doc.ja/index.html +39 -0
- data/site/outdated/doc.ja/mail.html +793 -0
- data/site/outdated/doc.ja/mailbox.html +265 -0
- data/site/outdated/doc.ja/port.html +95 -0
- data/site/outdated/doc.ja/tmail.html +58 -0
- data/site/outdated/doc.ja/usage.html +202 -0
- data/site/outdated/rdd/address.rrd.m +229 -0
- data/site/outdated/rdd/basics.rd.m +275 -0
- data/site/outdated/rdd/config.rrd.m +26 -0
- data/site/outdated/rdd/details.rd.m +117 -0
- data/site/outdated/rdd/index.rhtml.m +54 -0
- data/site/outdated/rdd/mail.rrd.m +701 -0
- data/site/outdated/rdd/mailbox.rrd.m +228 -0
- data/site/outdated/rdd/port.rrd.m +69 -0
- data/site/outdated/rdd/tmail.rrd.m +33 -0
- data/site/outdated/rdd/usage.rd.m +247 -0
- data/site/quickstart/index.html +69 -0
- data/site/quickstart/quickstart.html +52 -0
- data/site/quickstart/usage.html +193 -0
- data/site/reference/address.html +247 -0
- data/site/reference/config.html +30 -0
- data/site/reference/index.html +101 -0
- data/site/reference/mail.html +726 -0
- data/site/reference/mailbox.html +245 -0
- data/site/reference/port.html +75 -0
- data/site/reference/tmail.html +35 -0
- data/test/extctrl.rb +6 -0
- data/test/fixtures/mailbox +414 -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/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_multiple_from +30 -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_with_bad_date +48 -0
- data/test/fixtures/raw_email_with_double_carriage_return +179 -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_illegal_boundary +58 -0
- data/test/kcode.rb +14 -0
- data/test/temp_test_one.rb +46 -0
- data/test/test_address.rb +1214 -0
- data/test/test_attachments.rb +73 -0
- data/test/test_base64.rb +64 -0
- data/test/test_encode.rb +85 -0
- data/test/test_header.rb +1002 -0
- data/test/test_helper.rb +9 -0
- data/test/test_mail.rb +761 -0
- data/test/test_mbox.rb +184 -0
- data/test/test_port.rb +436 -0
- data/test/test_quote.rb +107 -0
- data/test/test_scanner.rb +209 -0
- data/test/test_utils.rb +36 -0
- data/work/script/make +26 -0
- data/work/script/rdoc +39 -0
- data/work/script/setup +1616 -0
- data/work/script/test +30 -0
- metadata +298 -0
data/log/Todo.txt
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
== TODO List
|
2
|
+
|
3
|
+
* NORUBYEXT should probbly be renamed to TMAIL_NORUBYEXT or something to that effect.
|
4
|
+
|
5
|
+
This is the original list left over from the 2004 version.
|
6
|
+
|
7
|
+
Please refer to the website (http://tmail.rubyforge.org/) for the current TODO list.
|
8
|
+
|
9
|
+
* RFC2231 decode
|
10
|
+
* delete File*Stream
|
11
|
+
* simplify field.rb
|
12
|
+
* allow raw JIS string in quoted word
|
13
|
+
* unify character encoding of japanese strings in header
|
14
|
+
* Loader -> Mailbox
|
15
|
+
* RFC2231 encode
|
16
|
+
* allow illegal MIME param value encoding (key="=?iso-2022-jp?B?....")
|
17
|
+
* purpose-oriented policy switching
|
18
|
+
* rewrite samples.
|
19
|
+
* address/address-group common handling scheme
|
20
|
+
* correct handling of Content-Type: message/*
|
21
|
+
* methods for mail creation, replying, forwarding
|
22
|
+
* tmail/net
|
23
|
+
* mail thread generator
|
24
|
+
|
25
|
+
=== Bugs
|
26
|
+
|
27
|
+
* mails may be deleted if other precesses are touching mailbox.
|
28
|
+
* mails may be corrupted if other precesses are touching mailbox.
|
29
|
+
* not thread safe
|
30
|
+
|
data/meta/MANIFEST
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
# -x doc -x pkg -x log
|
2
|
+
CHANGES
|
3
|
+
LICENSE
|
4
|
+
NOTES
|
5
|
+
README
|
6
|
+
ext
|
7
|
+
ext/Makefile
|
8
|
+
ext/tmailscanner
|
9
|
+
ext/tmailscanner/tmail
|
10
|
+
ext/tmailscanner/tmail/MANIFEST
|
11
|
+
ext/tmailscanner/tmail/depend
|
12
|
+
ext/tmailscanner/tmail/extconf.rb
|
13
|
+
ext/tmailscanner/tmail/tmailscanner.c
|
14
|
+
lib
|
15
|
+
lib/tmail
|
16
|
+
lib/tmail/Makefile
|
17
|
+
lib/tmail/address.rb
|
18
|
+
lib/tmail/attachments.rb
|
19
|
+
lib/tmail/base64.rb
|
20
|
+
lib/tmail/compat.rb
|
21
|
+
lib/tmail/config.rb
|
22
|
+
lib/tmail/core_extensions.rb
|
23
|
+
lib/tmail/encode.rb
|
24
|
+
lib/tmail/header.rb
|
25
|
+
lib/tmail/index.rb
|
26
|
+
lib/tmail/interface.rb
|
27
|
+
lib/tmail/loader.rb
|
28
|
+
lib/tmail/mail.rb
|
29
|
+
lib/tmail/mailbox.rb
|
30
|
+
lib/tmail/main.rb
|
31
|
+
lib/tmail/mbox.rb
|
32
|
+
lib/tmail/net.rb
|
33
|
+
lib/tmail/obsolete.rb
|
34
|
+
lib/tmail/parser.rb
|
35
|
+
lib/tmail/parser.y
|
36
|
+
lib/tmail/port.rb
|
37
|
+
lib/tmail/quoting.rb
|
38
|
+
lib/tmail/require_arch.rb
|
39
|
+
lib/tmail/scanner.rb
|
40
|
+
lib/tmail/scanner_r.rb
|
41
|
+
lib/tmail/stringio.rb
|
42
|
+
lib/tmail/utils.rb
|
43
|
+
lib/tmail/version.rb
|
44
|
+
lib/tmail.rb
|
45
|
+
meta
|
46
|
+
meta/MANIFEST
|
47
|
+
meta/config.yaml
|
48
|
+
meta/icli.yaml
|
49
|
+
meta/project.yaml
|
50
|
+
meta/tmail.roll
|
51
|
+
sample
|
52
|
+
sample/bench_base64.rb
|
53
|
+
sample/data
|
54
|
+
sample/data/multipart
|
55
|
+
sample/data/normal
|
56
|
+
sample/data/sendtest
|
57
|
+
sample/data/simple
|
58
|
+
sample/data/test
|
59
|
+
sample/extract-attachements.rb
|
60
|
+
sample/from-check.rb
|
61
|
+
sample/multipart.rb
|
62
|
+
sample/parse-bench.rb
|
63
|
+
sample/parse-test.rb
|
64
|
+
sample/sendmail.rb
|
65
|
+
script
|
66
|
+
script/changelog
|
67
|
+
script/clobber
|
68
|
+
script/clobber/distclean
|
69
|
+
script/clobber/package
|
70
|
+
script/compile
|
71
|
+
script/pack
|
72
|
+
script/pack/gem
|
73
|
+
script/pack/tgz
|
74
|
+
script/pack/zip
|
75
|
+
script/prepare
|
76
|
+
script/publish
|
77
|
+
script/rdoc
|
78
|
+
script/release
|
79
|
+
script/setup
|
80
|
+
script/stamp
|
81
|
+
script/stats
|
82
|
+
script/tag
|
83
|
+
script/test
|
84
|
+
test
|
85
|
+
test/extctrl.rb
|
86
|
+
test/fixtures
|
87
|
+
test/fixtures/mailbox
|
88
|
+
test/fixtures/mailbox_without_any_from_or_sender
|
89
|
+
test/fixtures/mailbox_without_from
|
90
|
+
test/fixtures/mailbox_without_return_path
|
91
|
+
test/fixtures/raw_base64_decoded_string
|
92
|
+
test/fixtures/raw_base64_email
|
93
|
+
test/fixtures/raw_base64_encoded_string
|
94
|
+
test/fixtures/raw_email
|
95
|
+
test/fixtures/raw_email10
|
96
|
+
test/fixtures/raw_email11
|
97
|
+
test/fixtures/raw_email12
|
98
|
+
test/fixtures/raw_email13
|
99
|
+
test/fixtures/raw_email2
|
100
|
+
test/fixtures/raw_email3
|
101
|
+
test/fixtures/raw_email4
|
102
|
+
test/fixtures/raw_email5
|
103
|
+
test/fixtures/raw_email6
|
104
|
+
test/fixtures/raw_email7
|
105
|
+
test/fixtures/raw_email8
|
106
|
+
test/fixtures/raw_email9
|
107
|
+
test/fixtures/raw_email_quoted_with_0d0a
|
108
|
+
test/fixtures/raw_email_reply
|
109
|
+
test/fixtures/raw_email_simple
|
110
|
+
test/fixtures/raw_email_with_bad_date
|
111
|
+
test/fixtures/raw_email_with_illegal_boundary
|
112
|
+
test/fixtures/raw_email_with_multipart_mixed_quoted_boundary
|
113
|
+
test/fixtures/raw_email_with_nested_attachment
|
114
|
+
test/fixtures/raw_email_with_partially_quoted_subject
|
115
|
+
test/fixtures/raw_email_with_quoted_illegal_boundary
|
116
|
+
test/kcode.rb
|
117
|
+
test/test_address.rb
|
118
|
+
test/test_attachments.rb
|
119
|
+
test/test_base64.rb
|
120
|
+
test/test_encode.rb
|
121
|
+
test/test_header.rb
|
122
|
+
test/test_helper.rb
|
123
|
+
test/test_mail.rb
|
124
|
+
test/test_mbox.rb
|
125
|
+
test/test_port.rb
|
126
|
+
test/test_quote.rb
|
127
|
+
test/test_scanner.rb
|
128
|
+
test/test_utils.rb
|
data/meta/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.2.3.1 stable (2008-04-11)
|
data/meta/project.yaml
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
project : tmail
|
3
|
+
version : 1.2.3.1
|
4
|
+
status : production
|
5
|
+
title : TMail
|
6
|
+
brief : Ruby Mail Handler
|
7
|
+
contact : Mikel Lindsaar <raasdnil AT gmail.com>
|
8
|
+
email : tmail-talk@rubyforge.org
|
9
|
+
homepage: http://tmail.rubyforge.org
|
10
|
+
authors :
|
11
|
+
- Minero Aoki
|
12
|
+
- Mikel Lindsaar
|
13
|
+
|
14
|
+
description:
|
15
|
+
TMail is a Ruby-based mail handler. It allows you
|
16
|
+
to compose stadards compliant emails in a
|
17
|
+
very Ruby-way.
|
18
|
+
|
19
|
+
loadpath:
|
20
|
+
- lib
|
21
|
+
- ext/tmailscanner
|
22
|
+
|
23
|
+
exclude: [doc,work]
|
24
|
+
|
25
|
+
hosts:
|
26
|
+
rubyforge:
|
27
|
+
type: rubyforge
|
28
|
+
rubytalk:
|
29
|
+
type: rubytalk
|
30
|
+
|
data/meta/unixname
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
tmail
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# base64 benchmark
|
2
|
+
#
|
3
|
+
# pass 'c' as first argument to bench c lib.
|
4
|
+
|
5
|
+
require 'benchmark'
|
6
|
+
|
7
|
+
module TMail
|
8
|
+
module Base64
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
$lib = ARGV[0]
|
13
|
+
$count = 10000
|
14
|
+
$size = 5000
|
15
|
+
|
16
|
+
def make_random_string(len)
|
17
|
+
buf = ''
|
18
|
+
len.times do
|
19
|
+
buf << rand(255)
|
20
|
+
end
|
21
|
+
buf
|
22
|
+
end
|
23
|
+
|
24
|
+
def encode_and_decode(orig)
|
25
|
+
#ok = [orig].pack('m').delete("\r\n")
|
26
|
+
end
|
27
|
+
|
28
|
+
if $lib == "c"
|
29
|
+
$lib = " c"
|
30
|
+
require 'ext/base64_c/tmail/base64_c.bundle'
|
31
|
+
else
|
32
|
+
$lib = "ruby"
|
33
|
+
require 'lib/tmail/base64_r.rb'
|
34
|
+
end
|
35
|
+
|
36
|
+
def benchmark!
|
37
|
+
Benchmark.bm do |x|
|
38
|
+
x.report("#{$lib} #{$count.to_s}/#{$size}: ") do
|
39
|
+
$count.times do
|
40
|
+
orig = make_random_string($size)
|
41
|
+
result = TMail::Base64.encode(orig)
|
42
|
+
TMail::Base64.decode(result)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
benchmark!
|
@@ -0,0 +1,23 @@
|
|
1
|
+
Date: Tue, 26 Jan 1999 23:17:34 +0900
|
2
|
+
From: aamine@dp.u-netsurf.ne.jp
|
3
|
+
To: ruby-list@netlab.co.jp
|
4
|
+
Mime-Version: 1.0
|
5
|
+
Content-Type: multipart/mixed;
|
6
|
+
boundary="Multipart_Tue_Jan_26_23:14:41_1999-1"
|
7
|
+
Content-Transfer-Encoding: 7bit
|
8
|
+
|
9
|
+
this is preamble
|
10
|
+
|
11
|
+
--Multipart_Tue_Jan_26_23:14:41_1999-1
|
12
|
+
Content-Type: text/plain; charset=iso-2022-jp
|
13
|
+
|
14
|
+
this is multi part body 1
|
15
|
+
|
16
|
+
--Multipart_Tue_Jan_26_23:14:41_1999-1
|
17
|
+
Content-Type: text/plain; charset=iso-2022-jp
|
18
|
+
|
19
|
+
multi part body, 2
|
20
|
+
|
21
|
+
--Multipart_Tue_Jan_26_23:14:41_1999-1--
|
22
|
+
|
23
|
+
epilogue
|
data/sample/data/normal
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
Received: from hoyogw.netlab.co.jp (daemon@hoyogw.netlab.co.jp [202.218.249.220])
|
2
|
+
by serv1.u-netsurf.ne.jp (8.8.8/3.6W-2.66(99/03/09)) with ESMTP id RAA10692
|
3
|
+
for <aamine@dp.u-netsurf.ne.jp>; Thu, 18 Mar 1999 17:35:23 +0900 (JST)
|
4
|
+
Received: from hoyogw.netlab.co.jp (matz@localhost [127.0.0.1])
|
5
|
+
by hoyogw.netlab.co.jp (8.9.1a+3.1W/3.7W/1.3) with SMTP id RAA13204;
|
6
|
+
Thu, 18 Mar 1999 17:21:58 +0900
|
7
|
+
Received: from blade.nagaokaut.ac.jp (sinara@blade.nagaokaut.ac.jp [133.44.36.60])
|
8
|
+
by hoyogw.netlab.co.jp (8.9.1a+3.1W/3.7W/1.3) with ESMTP id RAA13036
|
9
|
+
for <ruby-list@netlab.co.jp>; Thu, 18 Mar 1999 17:20:28 +0900
|
10
|
+
Received: (from sinara@localhost)
|
11
|
+
by blade.nagaokaut.ac.jp (8.8.8/8.8.8/Debian/GNU) id RAA22078;
|
12
|
+
Thu, 18 Mar 1999 17:20:49 +0900
|
13
|
+
Posted: Thu, 18 Mar 1999 17:20:49 +0900
|
14
|
+
Reply-To: ruby-list@netlab.co.jp
|
15
|
+
Subject: [ruby-list:12994] Re: Sieve of Eratosthenes (Re: [ruby-dev:6094])
|
16
|
+
Message-Id: <199903180820.RAA22078@blade.nagaokaut.ac.jp>
|
17
|
+
In-Reply-To: message of "Wed, 17 Mar 1999 18:42:07 +0900"
|
18
|
+
<199903170941.SAA12014@blade.nagaokaut.ac.jp>
|
19
|
+
Mime-Version: 1.0
|
20
|
+
Content-Type: text/plain; charset = iso-2022-jp
|
21
|
+
Content-Transfer-Encoding: 7bit
|
22
|
+
Date: Thu, 18 Mar 1999 17:21:54 +0900
|
23
|
+
To: ruby-list@netlab.co.jp (ruby mailing list)
|
24
|
+
From: (this is comment) local@dom1.dom2
|
25
|
+
Subject: this is a test subject
|
26
|
+
|
27
|
+
line 1
|
28
|
+
line 2
|
29
|
+
line 3
|
data/sample/data/simple
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
To: これはデコード済 <aamine@dp.u-netsurf.ne.jp>
|
2
|
+
From: =?iso-2022-jp?B?GyRCJDMkbCRPJSglcyUzITwlSSQ1JGwkRiQkJD8bKEI=?=
|
3
|
+
<myself@softica.or.jp>
|
4
|
+
Received: from fromdom.fromdom by bydom.bydom
|
5
|
+
via VIAPATH with SMTP id <msgid@tmail> for addr@spec
|
6
|
+
; 23 Mar 1999 22:05:33 +0900
|
7
|
+
Mime-Version: 1.0
|
8
|
+
Content-Type: text/plain; charset=iso-2022-jp
|
9
|
+
Content-Transfer-Encoding: 7bit
|
10
|
+
Subject: this is a test subject
|
11
|
+
|
12
|
+
body line 1
|
13
|
+
body line 2
|
14
|
+
body line 3
|
data/sample/data/test
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
Received: from hoyogw.netlab.co.jp (matz@localhost [127.0.0.1])
|
2
|
+
by hoyogw.netlab.co.jp (8.9.1a+3.1W/3.7W/1.3)
|
3
|
+
with SMTP id RAA13204;
|
4
|
+
Thu, 18 Mar 1999 17:21:58 +0900
|
5
|
+
Received: from fromdom.fromdom by bydom.bydom
|
6
|
+
via VIAPATH with SMTP id <msgid@tmail> for addr@spec;
|
7
|
+
23 Mar 1999 22:05:33 +0900
|
8
|
+
Date: Thu, 18 Mar 1999 17:21:54 +0900
|
9
|
+
To: ����ϥǥ����ɺ� <"aamine@"@dp.u-netsurf.ne.jp> (Minero Aoki)
|
10
|
+
Cc:
|
11
|
+
Bcc: =?iso-2022-jp?B?GyRCJDMkbCRPJUclMyE8JUk6URsoQg==?=
|
12
|
+
=?iso-2022-jp?B?PGFhbWluZUBkcC51LW5ldHN1cmYubmUuanA+?=
|
13
|
+
From: =?iso-2022-jp?B?GyRCJDMkbCRPJSglcyUzITwlSSQ1JGwkRiQkJD8bKEI=?=
|
14
|
+
(From comment) (comment2) <myself@softica.or.jp>
|
15
|
+
Posted: Thu, 18 Mar 1999 17:20:49 +0900
|
16
|
+
Reply-To: ruby-list@netlab.co.jp
|
17
|
+
Subject: [ruby-list:12994] Re: Sieve of Eratosthenes
|
18
|
+
Message-Id: <199903180820.RAA22078@blade.nagaokaut.ac.jp>
|
19
|
+
In-Reply-To: "Wed, 17 Mar 1999 18:42:07 +0900"
|
20
|
+
<199903170941.SAA12014@blade.nagaokaut.ac.jp>
|
21
|
+
Mime-Version: 1.0
|
22
|
+
Content-Type: text/plain; charset=iso-2022-jp
|
23
|
+
Content-Transfer-Encoding: 7bit
|
24
|
+
|
25
|
+
line 1
|
26
|
+
line 2
|
27
|
+
line 3
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#
|
2
|
+
# extract-attachments.rb -- Extracts attachment(s) from the message.
|
3
|
+
#
|
4
|
+
# Usage: ruby extract-attachments.rb mail mail...
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'tmail'
|
8
|
+
|
9
|
+
def main
|
10
|
+
idx = 1
|
11
|
+
ARGV.each do |fname|
|
12
|
+
TMail::Mail.load(fname).parts.each do |m|
|
13
|
+
m.base64_decode
|
14
|
+
File.open("#{idx}.#{ext(m)}", 'w') {|f|
|
15
|
+
f.write m.body
|
16
|
+
}
|
17
|
+
idx += 1
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
CTYPE_TO_EXT = {
|
23
|
+
'image/jpeg' => 'jpeg',
|
24
|
+
'image/gif' => 'gif',
|
25
|
+
'image/png' => 'png',
|
26
|
+
'image/tiff' => 'tiff'
|
27
|
+
}
|
28
|
+
|
29
|
+
def ext( mail )
|
30
|
+
CTYPE_TO_EXT[mail.content_type] || 'txt'
|
31
|
+
end
|
32
|
+
|
33
|
+
main
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#
|
2
|
+
# checking mail From: header
|
3
|
+
#
|
4
|
+
|
5
|
+
require 'tmail'
|
6
|
+
|
7
|
+
unless ARGV[0] then
|
8
|
+
$stderr.puts "usage: ruby fromcheck.rb <mhdir>"
|
9
|
+
exit 1
|
10
|
+
end
|
11
|
+
|
12
|
+
table = {} # from-addr-spec => [count, friendly-from]
|
13
|
+
ld = TMail::MhLoader.new( ARGV[0] )
|
14
|
+
ld.each_port do |port|
|
15
|
+
mail = TMail::Mail.new( port )
|
16
|
+
addr, = mail.from_addrs
|
17
|
+
if addr then
|
18
|
+
(table[addr.spec] ||= [0, mail.friendly_from])[0] += 1
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
table.to_a.sort {|a,b|
|
23
|
+
b[1][0] <=> a[1][0]
|
24
|
+
}.each_with_index do |(spec,(n,from)), i|
|
25
|
+
printf "%3d %-33s %d\n", i+1, from, n
|
26
|
+
end
|
data/sample/multipart.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
#
|
2
|
+
# MIME multipart parsing test
|
3
|
+
#
|
4
|
+
|
5
|
+
require 'tmail'
|
6
|
+
|
7
|
+
mail = TMail::Mail.load( ARGV[0] || 'data/multipart' )
|
8
|
+
|
9
|
+
puts '========= preamble =============='
|
10
|
+
puts mail.body
|
11
|
+
puts
|
12
|
+
|
13
|
+
puts '========== parts ================'
|
14
|
+
mail.parts.each_with_index do |i,idx|
|
15
|
+
puts "<#{idx+1}>"
|
16
|
+
puts i
|
17
|
+
puts
|
18
|
+
end
|
19
|
+
|
20
|
+
puts '========= epilogue =============='
|
21
|
+
puts mail.epilogue
|
22
|
+
puts
|
23
|
+
|
24
|
+
puts "========= re-struct ============="
|
25
|
+
puts mail.decoded
|
26
|
+
puts
|