1 |
<?xml version="1.0" encoding="iso-2022-jp"?> |
2 |
<?xml-stylesheet href="/s/simpledoc.css" type="text/css" ?> |
3 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" |
4 |
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
5 |
<html xml:lang="ja" xmlns="http://www.w3.org/1999/xhtml"> |
6 |
<head> |
7 |
<title xml:lang="en">Message::* Perl modules</title> |
8 |
<link rel="index" href="./" /> |
9 |
<link rel="stylesheet" href="/s/simpledoc.css" type="text/css" /> |
10 |
<link rev="made" href="mailto:w@suika.fam.cx" /> |
11 |
<link rel="copyright" href="/c/pd" title="Public Domain." /> |
12 |
<meta name="author" content="$B<cMU(B" /> |
13 |
<meta name="keywords" content="Perl, module, pm, Message, RFC 822, RFC 2822, RFC 1036, son-of-RFC1036, MIME, Usefor, HTTP, CGI, header, field" /> |
14 |
</head> |
15 |
<body> |
16 |
<h1>Message::* Perl modules</h1> |
17 |
|
18 |
<h2>$B$O$8$a$N$O$8$a$K(B</h2> |
19 |
|
20 |
<p>$B$?$H$($P(B Perl $B$G=q$+$l$?(B CGI script, $B$=$l$b7G<(HD$J$s$+$K$O!"(B |
21 |
$B$3$s$J$_$C$H$b$J$$(B code $B$,:\$C$F$$$?$j$7$^$9!#(B</p> |
22 |
|
23 |
<pre class="example"><code class="perl">jcode'convert(*from, "jis"); |
24 |
jcode'convert(*subject, "jis"); |
25 |
jcode'convert(*message, "jis"); |
26 |
open (MAIL, "| $sendmail"); |
27 |
print MAIL "From: $mail ($from)\n"; |
28 |
print MAIL "To: $mailto\n"; |
29 |
print MAIL "Subject: $subject\n"; |
30 |
print MAIL "\n"; |
31 |
print MAIL "$message"; |
32 |
print MAIL "\n"; |
33 |
close (MAIL); |
34 |
</code></pre> |
35 |
|
36 |
<p>$B$3$l$G$O;kG'@-$bNI$/$J$$$G$9$7!"$&$C$+$j=$@5$74V0c$($k$H(B |
37 |
$BJQ$J%a%C%;!<%8$rAw?.$7$F$7$^$$$^$9!#(B |
38 |
($BI.<T$O$7$g$C$A$e$&$O$^$C$F$^$7$?(B:-) |
39 |
($B$=$l$KB?$/$N(B code $B$G$O!"(B |
40 |
HTML $B$G$N%/%m%9%5%$%H%9%/%j%W%F%#%s%0(B (CSS) $BLdBj$H(B |
41 |
$BN`;w$NLdBj$X$NBP=h$r$7$F$$$^$;$s!#(B)</p> |
42 |
|
43 |
<p>$B%*%V%8%'%/%H;X8~$r<h$jF~$l$F<!$N$h$&$J46$8$G%a%C%;!<%8$r(B |
44 |
$B9=@.$7$?$$$H$3$m$G$9!#(B</p> |
45 |
|
46 |
<pre class="application-x-perl"> |
47 |
use Message::Entity; |
48 |
my $msg = new Message::Entity; |
49 |
my $hdr = $msg->header; |
50 |
$hdr->add ('From')->add ('me@bar.example'); |
51 |
$hdr->add ('To')->add (['foo@bar.example', display_name => 'Mr. foo']); |
52 |
$hdr->add (Subject => $subject); |
53 |
$msg->body ($body); |
54 |
|
55 |
# $smtp->send $B$O(B SMTP $B$GAw?.$9$k(B method $B$H2>Dj!#(B |
56 |
$smtp->send ($msg); |
57 |
</pre> |
58 |
|
59 |
<p><a href="http://www.cpan.org/" xml:lang="en">CPAN</a> $B$rC5$9$H!"(B |
60 |
$B$3$l$K;w$?$h$&$J$3$H$,$G$-$=$&$J%b%8%e!<%k$O$"$k$h$&$G$9$,!"(B |
61 |
$B<B:]$K;H$C$F$_$k$H!"M?$($kCM$K$h$C$F$O(B <a href="urn:ietf:rfc:822">RFC 822</a>/<a href="urn:ietf:rfc:2822">2822</a> $B$K0cH?$9$k(B |
62 |
$B7k2L$r=PNO$9$k$H$+!"$=$b$=$b$=$l0JA0$K!"(B |
63 |
<code>$hdr->addr ('Foo Bar <foo@bar.example>')</code> |
64 |
$B$N$h$&$K%a%C%;!<%87A<0$r%b%8%e!<%kFb$K1#F?$7$-$l$F$$$J$$$H$+!"Hs(B |
65 |
ASCII $BJ8;z$r9MN8$7$F$$$J$$$H$+$NITK~$,$"$j$^$9!#(B</p> |
66 |
|
67 |
<p class="note">($B<BAuJ}?K$H$7$F$OIT@5$JCM$O%b%8%e!<%k$KEO$9A0$KCF$/$Y$-$H$$$&9M$(J}$b$"$k$G$7$g$&$1$I!"0lHLE*$JMxMQ$K:]$7$F$O8-$$@_7W$@$H$O;W$($^$;$s!#(B)</p> |
68 |
|
69 |
<p>$B$H$$$&$3$H$G!"$O$8$a$O4{B8$N%b%8%e!<%k$N(B wrapper ($B$"$k$$$OJd40(B) |
70 |
$B$r=q$/$D$b$j$G$7$?$,!"$J$s$@$+$4$A$c$4$A$c$7$F$$$F!"(B |
71 |
$B$=$l$J$i<VNX$N:FH/L@$K$J$C$F$b0l$+$i=q$$$F$_$h$&$H9M$($^$7$?!#(B</p> |
72 |
|
73 |
<h2>$BFC?'(B ($B$H$$$&Dx$N$b$N$G$b$J$$!#(B)</h2> |
74 |
|
75 |
<ol> |
76 |
<li>$B7k9=%*%V%8%'%/%H;X8~$G$9!#(B</li> |
77 |
<li>RFC 822/2822 $B$N(B <code class="bnf rfc2822">group</code> $B$r2r<a=PMh$^$9!#(B</li> |
78 |
<li><a href="urn:ietf:id:draft-ietf-usefor-msg-id-alt-00">draft-ietf-usefor-msg-id-alt-00</a> $B$K4p$E$$$?Aw?.%"%I%l%9$J$I$K$h$k(B <code class="rfc2822">Message-ID</code> $B$r@8@.=PMh$^$9!#(B</li> |
79 |
<li><a href="charset" title="$BJ8;z%3!<%I$N07$$(B">$BJ8;z%3!<%IJQ49=hM}$r30It$KDI$$=P$7$F$$$^$9(B</a>$B!#(B |
80 |
jcode.pl $B$G$b(B Jcode.pm $B$G$b(B Encode::* $B$G$b!"9%$-$J$b$N$r$*;H$$2<$5$$!#(B</li> |
81 |
<li>MIME (<a href="urn:ietf:rfc:2045">RFC 2045</a>, |
82 |
<a href="urn:ietf:rfc:2046">2046</a>) $B$K$[$\40A4$KBP1~$7$F$$$^$9!#(B</li> |
83 |
</ol> |
84 |
|
85 |
<h2>$B3F;EMM$X$NBP1~>u67(B</h2> |
86 |
|
87 |
<ol> |
88 |
<li>$BEE;R%a%$%k$N%a%C%;!<%8(B (RFC 822, RFC 2822) |
89 |
$B$NA45!G=$KBP1~$7$F$$$^$9!#(B</li> |
90 |
<li>$BEE;R%K%e!<%95-;v(B (<a href="/uri-res/N2L?urn:ietf:rfc:1036">RFC 1036</a>, |
91 |
<a href="spec/son-of-RFC1036">son-of-RFC1036</a>, |
92 |
<a href="/uri-res/N2L?urn:ietf:id:draft-usefor-article-06"> |
93 |
draft-usefor-article (06)</a>) $B$NF,NN0h$NB?$/$KBP1~$7$F$$$^$9!#(B</li> |
94 |
<li>MIME $B$NK\J8ItJ,(B (body part) $B$KBP1~$7$F$$$^$9!#(B |
95 |
<ul> |
96 |
<li>$BB?ItJ,(B (multipart) $B$dJ,3d(B (message/partial), |
97 |
$B30ItK\J,(B (message/external-body) $B$r07$&$3$H$,=PMh$^$9!#(B</li> |
98 |
<li>text/plain; format=flowed |
99 |
(<a href="urn:ietf:rfc:2646">RFC 2646</a>) |
100 |
$B$KBP1~$7$F$$$^$9!#(B</li> |
101 |
<li>Content-Transfer-Encoding $B$O(B Base64, Quoted-Printable |
102 |
$B$OL^O@!"(B x-uuencode, x-gzip64 $B$K$bBP1~!#(B |
103 |
RFC 2822 $B%a%$%k=PNO%b!<%I$G$O!"K\J8$,(B8$B%S%C%H$G$b<+F0E*$KE,@Z$J(B |
104 |
CTE $B$GId9f2=$7$^$9!#(B</li> |
105 |
</ul> |
106 |
</li> |
107 |
<li>MIME $B$NF,NN0h(B |
108 |
(<a href="/uri-res/N2L?urn:ietf:rfc:2045">RFC 2045</a>, |
109 |
<code class="mime">Content-Disposition</code>) $B$KBP1~$7$F$$$^$9!#(B |
110 |
$B%Q%i%a!<%?!<CM3HD%(B (<a href="/uri-res/N2L?urn:ietf:rfc:2231">RFC 2231</a>) |
111 |
$B$bF~=PNO$H$b$K<BAu$7$^$7$?!#(B</li> |
112 |
<li>MIME $BId9f2=8l(B (<code class="mime bnf">encoded-word</code>) |
113 |
$B$N2rFI$KBP1~$7$F$$$^$9(B:-)</li> |
114 |
<li>HTTP/1.0, HTTP/1.1, CGI/1.1, CGI/1.2 $B$NF,NN0h$N$&$A!"(B |
115 |
$B$4$/0lIt$KBP1~$7$F$$$^$9!#(B MHTML $B$N(B |
116 |
<code class="mime">Content-Location</code> $B$K$bBP1~$7$F$$$^$9!#(B</li> |
117 |
<li>$BF|IU7A<0$G$O(B RFC 822/<a href="urn:ietf:rfc:1123">1123</a>, |
118 |
<a href="urn:ietf:rfc:733">RFC 733</a>, asctime, ISO 8601 (HTML) |
119 |
$B$J$I$KBP1~$7$F$$$^$9!#F|IU$N=PNO$O(B sprintf |
120 |
$B$NMM$J=q<0J8;zNs$rM?$($k$3$H$G!"B?<oB?MM$J7A<0$KBP1~!#(B</li> |
121 |
<li>X-Moe $B%7%j!<%:$KBP1~$7$F$$$^$9(B:-)</li> |
122 |
</ol> |
123 |
|
124 |
<h2>$B@)8B;v9`(B</h2> |
125 |
|
126 |
<ol> |
127 |
<li>$BN`;w%b%8%e!<%k(B($BFf(B)$B$N$h$&$K!"%U%!%$%kL>$d%U%!%$%k!&%O%s%I%k$r(B |
128 |
$BEO$7$FFI$_9~$^$;$k$3$H$,=PMh$^$;$s!#(B</li> |
129 |
<li>$BBg$-$J%a%C%;!<%8$G$b0l5$$KFI$_9~$_!"A4$F<g5-21NN0h$G(B |
130 |
$BJ];}$7$F$$$^$9!#$G$9$+$i$"$^$jBg$-$J%a%C%;!<%8$N=hM}$K$O(B |
131 |
$B8~$$$F$$$J$$$G$7$g$&!#(B</li> |
132 |
<li><code>CR</code> $B$d(B <code>LF</code> $B$,C1BN$G=P8=$9$k>l9g!"(B |
133 |
$B@5$7$/=hM}=PMh(B<del>$B$^$;$s(B</del><ins>$B$J$$$3$H$,$"$j$^$9(B |
134 |
($B6a$$>-Mh$NHG$G2~A1$NM=Dj(B)</ins>$B!#(B (<code>CRLF</code> $B$HEy2A$H$_$J$7$^$9!#(B) |
135 |
$B>-Mh$NHG$G$O%*%W%7%g%s$G@)8f2DG=$K$J$k$+$b$7$l$^$;$s!#(B</li> |
136 |
<li>$B@bL@J8(B (document; pod) $B$,$$$$2C8:$G$9(B ($B=q$/$N$,LLE]$@(B)$B!#(B</li> |
137 |
</ol> |
138 |
|
139 |
<h2>$BI,MW4D6-(B</h2> |
140 |
|
141 |
<ol> |
142 |
<li>Perl 5.6 $B0J9_(B |
143 |
<p class="note"><code class="bnf rfc822">comment</code> |
144 |
$B$rI=$9$N$K@55,I=8=(B |
145 |
<code class="regex">(??{ <var>code</var> })</code> |
146 |
$B$r;H$C$F$$$k$N$G!"$3$l$r2r<a=PMh$k!"(B |
147 |
5.6 $B0J9_$NHG$G$"$kI,MW$,$"$j$^$9!#(B</p> |
148 |
</li> |
149 |
<li>Digest::MD2, Digest::MD5, Digest::SHA1 |
150 |
<p>Message-ID $B$N@8@.$K$3$l$i$r;HMQ$9$k>l9g$N$_!"(B |
151 |
Message::Field::MsgID $B$,;H$$$^$9!#(B</p> |
152 |
<p><code class="bnf mime">Content-MD5:</code> $BNN0h$NIU2C$d8!>Z$r9T$&>l9g!"(B |
153 |
Digest::MD5 $B$,I,MW$G$9!#(B (Message::Entity)</p> |
154 |
</li> |
155 |
<li>MIME::Base64 |
156 |
<p>$B$A$J$_$K!"(B Quoted-Printable $B$d(B RFC 2231 $B$N(B |
157 |
% $BId9f2=$O<+NO$GI|9f$7$^$9!#(B</p> |
158 |
</li> |
159 |
<li>$BJ8;z%3!<%IJQ49=hM}(B |
160 |
<p>$BF|K\8l%a%C%;!<%8$r07$&$J$iI,?\$G$7$g$&!#(B |
161 |
$B>\$7$/$O(B<a href="#code">$BJ8;z%3!<%I$N07$$(B</a> |
162 |
$B$N>O$r$4;2>H2<$5$$!#(B</p> |
163 |
</li> |
164 |
</ol> |
165 |
|
166 |
<h2>$BF~<j(B</h2> |
167 |
|
168 |
<p>suika.fam.cx $B$N(B SSH account $B$r$*;}$A$N>l9g!"(B CVS $B$+$iF~<j=PMh$^$9!#(B</p> |
169 |
|
170 |
<p class="example">$ cvs -d :ext:<var xml:lang="en">username</var>@suika.fam.cx:/home/cvs -d perl/lib/Message/</p> |
171 |
|
172 |
<p>Web $B$+$i$b<h$j=P$;$^$9!#(B <<a href="/gate/cvs/perl/lib/Message/">http://suika.fam.cx/gate/cvs/perl/lib/Message/</a>></p> |
173 |
|
174 |
<p><a href="/gate/cvs/perl/lib/Message/Message.tar.gz?tarball=1">$B:G?7$N(B tarball $B$r<hF@(B</a>$B!#(B</p> |
175 |
|
176 |
<h2>$B%i%$%;%s%9(B</h2> |
177 |
|
178 |
<p>Message::* Perl modules $B$O<+M3%=%U%H%&%'%"$G$9!#(B |
179 |
GNU GPL $B$K=>$C$FMxMQ=PMh$^$9!#>\$7$/$O3F%U%!%$%k$r8fMw2<$5$$!#(B</p> |
180 |
|
181 |
<h2>$B4XO"J8=q$J$I(B</h2> |
182 |
|
183 |
<ul> |
184 |
<li id="code">$BJ8;z%3!<%I$N07$$(B</li> |
185 |
<li><a href="spec/">$B4XO"$9$k;EMM=q(B (RFC, Internet-Draft $BEy(B)</a></li> |
186 |
</ul> |
187 |
|
188 |
<h2>$B1~MQ(B</h2> |
189 |
|
190 |
<ul> |
191 |
<li><a href="/gate/cvs/tool/bunshin/">Bunshin.pm</a> |
192 |
<p>Web $B>e$NO"B3$9$k;q8;(B ($B7G<(HD$N5-;v$N$h$&$J$b$N(B) |
193 |
$B$r@Z$j=P$7$F(B RFC 822 $B7A<0$N%a%C%;!<%8$K$9$k%(%s%8%sItJ,!#(B</p> |
194 |
</li> |
195 |
<li><a href="/gate/cvs/tool/suikawari/">$B$9$$$+$o$j(B</a> |
196 |
<p>Bunshin.pm $B$r;H$C$F!"EE;R%K%e!<%9$K5-;v$rEj9F$9$k(B |
197 |
script$B!#(B (cron $B$H$+$+$i8F$S=P$7$F;H$&!#(B)</p> |
198 |
</li> |
199 |
</ul> |
200 |
|
201 |
<h2>$B:#8e$NM=Dj(B</h2> |
202 |
|
203 |
<ol> |
204 |
<li>$BEE;R%K%e!<%9$NF,NN0h(B (RFC 1036, |
205 |
<a href="spec/son-of-RFC1036">son-of-RFC1036</a>, |
206 |
draft-usefor-article) $B$N40A4<BAu(B</li> |
207 |
<li>$BDI2C(B/$BHsI8=`$NF,NN0h$N<BAu!#(B</li> |
208 |
<li>documentation$B!#(B</li> |
209 |
<li>$B;HMQNc$N:n@.!#(B</li> |
210 |
<li>$B4{B8%b%8%e!<%k$,MxMQ=PMh$kItJ,$O!"$=$l$r8F$S=P$9$h$&$K$9$k$+(B |
211 |
$B$=$N(B code $B$rN.MQ$9$k!#(B</li> |
212 |
<li>$BN`;w%b%8%e!<%k$H$N3&LL$N6&DL2=(B</li> |
213 |
<li>HTTP $BMQ$K;H$($k$h$&$K$9$k(B</li> |
214 |
</ol> |
215 |
|
216 |
<div class="navigation"> |
217 |
[<a href="/" title="$B$3$N%5!<%P!<$N<sJG(B">/</a> |
218 |
<a href="/map" title="$B$3$N%5!<%P!<$N0FFb(B" rel="index">$BCO?^(B</a> |
219 |
<a href="/search/" title="$B$3$N%5!<%P!<$N8!:w(B">$B8!:w(B</a>] |
220 |
<a href="http://validator.w3.org/check/referer" xml:lang="en"><img |
221 |
src="http://www.w3.org/Icons/valid-xhtml11" id="w3c-html" |
222 |
alt="Valid XHTML 1.1!" style="height: 31px; width: 88px" /></a> |
223 |
<a href="http://jigsaw.w3.org/css-validator/validator?uri=http://suika.fam.cx/~wakaba/Message-pm/introduction.ja.html" xml:lang="en"> |
224 |
<img style="width: 88px; height: 31px" id="w3c-css" |
225 |
src="http://jigsaw.w3.org/css-validator/images/vcss" |
226 |
alt="Valid CSS!" /></a> |
227 |
</div> |
228 |
<div class="update">$Date: 2002/06/14 12:46:34 $</div> |
229 |
<ul class="myuri"> |
230 |
<li><URL:<a href="http://suika.fam.cx/~wakaba/Message-pm/introduction">http://suika.fam.cx/~wakaba/Message-pm/introduction</a>></li> |
231 |
<li><CVS:<a href="http://suika.fam.cx/gate/cvs/perl/web/Message-pm/">suika.fam.cx:/home/cvs/perl/web/Message-pm/</a>></li> |
232 |
</ul> |
233 |
</body></html> |