root/websites/perl-users.jp/html/modules/email_mime.html @ 29567

Revision 29567, 2.5 kB (checked in by tokuhirom, 5 years ago)

added document for Email::MIME

Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
3    <head profile="http://purl.org/net/ns/metaprof">
4        <!-- Document Metadata -->
5        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
6        <meta http-equiv="Content-Language" content="ja" />
7        <meta http-equiv="Content-Style-Type" content="text/css" />
8        <meta http-equiv="Content-Script-Type" content="text/javascript" />
9        <meta http-equiv="imagetoolbar" content="no" />
10
11        <!-- Atom news feed -->
12
13        <link rel="alternate" type="application/rss+xml" title="RSS feed" href="http://coderepos.org/share/log/websites/perl-users.jp?limit=100&amp;mode=stop_on_copy&amp;format=rss" />
14        <link rel="stylesheet" type="text/css" href="/css/perl-users.jp.css" />
15        <link rel="shortcut icon" href="/favicon.ico" type="image/vnd.microsoft.icon" />
16        <link rel="icon" href="/favicon.ico" type="image/vnd.microsoft.icon" />
17
18        <title>メールのパーズ(Email::MIME) - モダンなPerl入門 - モダンなPerl入門</title>
19
20        <script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>
21        <script type="text/javascript">
22            _uacct = "UA-4463402-1";
23            urchinTracker();
24        </script>
25        <!-- script src="/js/codepress/codepress.js" type="text/javascript"></script -->
26    </head>
27    <body>
28        <div id="head-navigation"><a href="/">Perl-users.jp</a></div>
29<!-- content start -->
30<h1>メールのパーズ</h1>
31
32<p>受信したメールをパーズするのには Email::MIME をつかいます。</p>
33
34<h3>つかいかた</h3>
35
36<pre><code>use strict;
37use warnings;
38use utf8;
39use Email::MIME;
40
41my $src = &lt;&lt;'...';
42Delivered-To: john@example.com
43Return-Path: &lt;tom@example.com&gt;
44Date: Wed, 04 Feb 2009 20:06:30 -0700
45Sender: &lt;tom@example.com&gt;
46From: Tom &lt;tom@example.com&gt;
47Subject: Hi, john
48To: &lt;john@example.com&gt;
49Content-Type: text/plain;
50    charset="iso-8859-2"
51Content-Transfer-Encoding: 8bit
52
53how are you?
54...
55
56my $mail = Email::MIME-&gt;new($src);
57print "Subject -&gt; @{[ $mail-&gt;header('Subject') ]}\n";
58print "Body -&gt; @{[ $mail-&gt;body ]}\n";
59</code></pre>
60
61<p>ごく簡単です。</p>
62
63<!-- content end -->
64        <hr />
65        <p><a href="/modern_introduction_perl/">目次へ</a></p>
66        <p>Last modified: $Date: 2008-05-22T09:21:23.154313Z $</p>
67    </body>
68</html>
Note: See TracBrowser for help on using the browser.