{"id":628,"date":"2006-05-09T01:00:00","date_gmt":"2006-05-08T16:00:00","guid":{"rendered":"https:\/\/ecoop.net\/memo\/2006-05-09-1.html"},"modified":"2026-08-10T14:36:12","modified_gmt":"2026-08-10T05:36:12","slug":"2006-05-09-1","status":"publish","type":"post","link":"https:\/\/www.ecoop.net\/memo\/archives\/2006-05-09-1.html","title":{"rendered":"\u30e1\u30fc\u30eb\u3092\u30d1\u30fc\u30b9\u3059\u308b\u30af\u30e9\u30b9"},"content":{"rendered":"<p>\n\u30e1\u30fc\u30eb\u3092\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u3059\u308b\u4e0a\u3067\u3001\u30e1\u30fc\u30eb\u30bd\u30fc\u30b9\u3092\u89e3\u6790\u3059\u308b\u3068\u3044\u3046\u51e6\u7406\u3092\u5b9f\u88c5\u3057\u3088\u3046\u3068\u3057\u3066\u30af\u30e9\u30b9\u304c\u306a\u3044\u304b\u63a2\u3057\u3066\u3044\u3066<br \/>\nGoogle \u3067 mail, email, parse, php, rfc822 \u3068\u304b\u691c\u7d22\u3057\u3066\u3044\u305f\u306e\u3067\u3059\u304c\u30e9\u30a4\u30bb\u30f3\u30b9\u5236\u9650\u306e\u306a\u3044\u3082\u306e\u304c\u5168\u7136\u898b\u4ed8\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002<br \/>\n\u3067\u3001\u3075\u3068 PEAR \u3092\u8ffd\u3063\u3066\u307f\u308b\u3068\u30d0\u30c3\u30c1\u30ea\u3042\u308a\u307e\u3057\u305f\u3002<br \/>\nMail_Mime \u3067\u30e1\u30fc\u30eb\u306e\u30a8\u30f3\u30b3\u30fc\u30c9\u3001Mail_mimeDecode \u3067\u30e1\u30fc\u30eb\u306e\u30c7\u30b3\u30fc\u30c9\u304c\u53ef\u80fd\u3067\u3059\u3002<br \/>\n&nbsp;<br \/>\nMail \u30d1\u30c3\u30b1\u30fc\u30b8\u306e Mail_mimeDecode \u3092\u4f7f\u3046\u3068\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<blockquote><p>require_once(&#8216;Mail\/mimeDecode.php&#8217;);<br \/>\n$mail = &#8221;;<br \/>\n\/\/ &#8230;<br \/>\n\/\/ ($mail \u306b\u30e1\u30fc\u30eb\u306e\u30bd\u30fc\u30b9\u3092\u683c\u7d0d\u3059\u308b\u51e6\u7406)<br \/>\n\/\/ &#8230;<br \/>\n&nbsp;<br \/>\n$params = array();<br \/>\n$params[&#8216;include_bodies&#8217;] = true;<br \/>\n$params[&#8216;decode_bodies&#8217;]  = true;<br \/>\n$params[&#8216;decode_headers&#8217;] = true;<\/p>\n<p>$decoder = new Mail_mimeDecode($mail);<br \/>\n$structure = $decoder->decode($params);<br \/>\nvar_dump($structure);\n<\/p><\/blockquote>\n<p>\u7d50\u679c(\u4e00\u90e8\u7701\u7565. \u6587\u5b57\u30b3\u30fc\u30c9\u306f JIS):\n<\/p>\n<blockquote><p>object(stdClass)(5) {<br \/>\n&nbsp;&nbsp;[&#8220;headers&#8221;]=><br \/>\n&nbsp;&nbsp;array(14) {<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;[&#8220;from sender@example.org   tue may  9 20&#8221;]=><br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;string(10) &#8220;21:03 2006&#8221;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;[&#8220;return-path&#8221;]=><br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;string(23) &#8220;&lt;sender@example.org>&#8221;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;[&#8220;x-original-to&#8221;]=><br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;string(14) &#8220;foo@example.com&#8221;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;[&#8220;delivered-to&#8221;]=><br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;string(14) &#8220;foo@example.com&#8221;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;[&#8220;received&#8221;]=><br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;array(3) { \/* ..snip.. *\/ }<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;[&#8220;date&#8221;]=><br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;string(31) &#8220;Tue, 09 May 2006 20:20:59 +0900&#8221;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;[&#8220;from&#8221;]=><br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;string(35) &#8220;&#8221;John&#8221; &lt;sender@example.org>&#8221;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;[&#8220;to&#8221;]=><br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;string(14) &#8220;foo@example.com&#8221;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;[&#8220;message-id&#8221;]=><br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;string(45) &#8220;&lt;114717365920816000001f81@example.org>&#8221;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;[&#8220;subject&#8221;]=><br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;string(19) &#8220;\u30c6\u30b9\u30c8&#8221;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;[&#8220;x-mailer&#8221;]=><br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;string(17) &#8220;Cybozu Office 6.5&#8221;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;[&#8220;mime-version&#8221;]=><br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;string(3) &#8220;1.0&#8221;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;[&#8220;content-type&#8221;]=><br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;string(31) &#8220;text\/plain; charset=iso-2022-jp&#8221;<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;[&#8220;content-transfer-encoding&#8221;]=><br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;string(4) &#8220;7bit&#8221;<br \/>\n&nbsp;&nbsp;}<br \/>\n&nbsp;&nbsp;[&#8220;ctype_primary&#8221;]=><br \/>\n&nbsp;&nbsp;string(4) &#8220;text&#8221;<br \/>\n&nbsp;&nbsp;[&#8220;ctype_secondary&#8221;]=><br \/>\n&nbsp;&nbsp;string(5) &#8220;plain&#8221;<br \/>\n&nbsp;&nbsp;[&#8220;ctype_parameters&#8221;]=><br \/>\n&nbsp;&nbsp;array(1) {<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;[&#8220;charset&#8221;]=><br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;string(11) &#8220;iso-2022-jp&#8221;<br \/>\n&nbsp;&nbsp;}<br \/>\n&nbsp;&nbsp;[&#8220;body&#8221;]=><br \/>\n&nbsp;&nbsp;string(495) &#8220;Hello, world!!<br \/>\n&#8220;<br \/>\n}\n<\/p><\/blockquote>\n<p>&nbsp;<br \/>\n\u6587\u5b57\u30b3\u30fc\u30c9\u306b\u3064\u3044\u3066\u306f\u4e00\u5207\u611f\u77e5\u3057\u3066\u3044\u306a\u3044\u306e\u304b mb_internal_encoding \u306e\u5024\u306b\u304b\u304b\u308f\u3089\u305a, charset \u3067\u6307\u5b9a\u3055\u308c\u3066\u3044\u308b\u901a\u308a JIS (iso-2022-jp) \u3067\u3057\u305f\u3002<br \/>\n&nbsp;<br \/>\nFrom: \u3084 To: \u306e\u89e3\u6790\u306b\u306f Mail_RFC822::parseAddressList() \u3068\u3044\u3046\u4fbf\u5229\u306a\u30e1\u30bd\u30c3\u30c9\u3082\u5b58\u5728\u3057\u307e\u3059\u3002\n<\/p>\n<blockquote><p>require_once &#8216;Mail\/RFC822.php&#8217;;<br \/>\n\/\/ $structure \u306f Mail_mimeDecode::decode() \u306e\u7d50\u679c<br \/>\n$from = Mail_RFC822::parseAddressList($structure->headers[&#8216;from&#8217;]);<br \/>\necho $from[0]->mailbox.&#8217;@&#8217;.$from[0]->host;<br \/>\n\/\/ \u7d50\u679c: sender@example.org\n<\/p><\/blockquote>\n<p>&nbsp;<br \/>\n\u53c2\u8003:<br \/>\n&#8211; Mail_mimeDecode &#8211; \u30e1\u30fc\u30eb\u30c7\u30b3\u30fc\u30c9\u306e\u4f8b(pear.php.net)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30e1\u30fc\u30eb\u3092\u30cf\u30f3\u30c9\u30ea\u30f3\u30b0\u3059\u308b\u4e0a\u3067\u3001\u30e1\u30fc\u30eb\u30bd\u30fc\u30b9\u3092\u89e3\u6790\u3059\u308b\u3068\u3044\u3046\u51e6\u7406\u3092\u5b9f\u88c5\u3057\u3088\u3046\u3068\u3057\u3066\u30af\u30e9\u30b9\u304c\u306a\u3044\u304b\u63a2\u3057\u3066\u3044\u3066 Google \u3067 mail, email, parse, php, rfc822 \u3068\u304b\u691c\u7d22\u3057\u3066\u3044\u305f\u306e\u3067\u3059\u304c\u30e9\u30a4\u30bb\u30f3 &hellip; <a href=\"https:\/\/www.ecoop.net\/memo\/archives\/2006-05-09-1.html\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">\u30e1\u30fc\u30eb\u3092\u30d1\u30fc\u30b9\u3059\u308b\u30af\u30e9\u30b9<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[141],"tags":[32],"class_list":["post-628","post","type-post","status-publish","format-standard","hentry","category-lifehack","tag-php"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/posts\/628","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/comments?post=628"}],"version-history":[{"count":2,"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/posts\/628\/revisions"}],"predecessor-version":[{"id":1587,"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/posts\/628\/revisions\/1587"}],"wp:attachment":[{"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/media?parent=628"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/categories?post=628"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ecoop.net\/memo\/wp-json\/wp\/v2\/tags?post=628"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}