{"id":1354,"date":"2009-10-08T01:27:02","date_gmt":"2009-10-07T16:27:02","guid":{"rendered":"http:\/\/mechsys.tec.u-ryukyu.ac.jp\/~oshiro\/SiteList\/?p=1354"},"modified":"2009-10-08T04:41:17","modified_gmt":"2009-10-07T19:41:17","slug":"%e3%83%a1%e3%83%bc%e3%83%ab%e3%81%b8%e3%81%ae%e8%87%aa%e5%8b%95%e8%bf%94%e4%bf%a1","status":"publish","type":"post","link":"http:\/\/mechsys.tec.u-ryukyu.ac.jp\/~oshiro\/SiteList\/2009\/10\/08\/1354\/","title":{"rendered":"\u30e1\u30fc\u30eb\u3078\u306e\u81ea\u52d5\u8fd4\u4fe1"},"content":{"rendered":"<p>\u5c4a\u3044\u305f\u30e1\u30fc\u30eb\u306b\u81ea\u52d5\u8fd4\u4fe1\u3059\u308b\u306b\u306f\u3001\/etc\/aliases\u306b\u53d7\u3051\u4ed8\u3051\u308b\u30a2\u30c9\u30ec\u30b9\u3092\u66f8\u304d\u3001\u305d\u3053\u306b\u5c4a\u3044\u305f\u30e1\u30fc\u30eb\u3092\u8fd4\u4fe1\u30d7\u30ed\u30b0\u30e9\u30e0\u3078\u30d1\u30a4\u30d7\u3067\u6e21\u3059\u3002<\/p>\n<p>\u6b21\u306e\u3088\u3046\u306b\u306a\u308b\u3002\u307e\u305a\u3001\/etc\/aliases\u3078\u306e\u30d1\u30a4\u30d7\u8a2d\u5b9a<\/p>\n<div class=\"hl-surround\" style=\"height:16.8px;\"><div class=\"hl-main\"><pre>hoge: &quot;|\/usr\/bin\/php \/home\/foo\/reply.php&quot;<\/pre><\/div><\/div>\n<p>php\u306e\u5834\u5408\u306f\u3001\u4ed6\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3068\u9055\u3063\u3066\u901a\u5e38\u306f\u5192\u982d\u306e\u8d77\u52d5\u30b7\u30a7\u30eb\u306e\u6307\u5b9a\uff08#!\/usr\/bin\/php\uff09\u306f\u542b\u307e\u306a\u3044\uff08\u3082\u3061\u308d\u3093\u542b\u3081\u3066\u3082\u3088\u3044\u304c\uff09\u305f\u3081\u3001\u30b9\u30af\u30ea\u30d7\u30c8\u540d\u3060\u3051\u3092\u66f8\u304f\u3068\u30dc\u30fc\u30f3\u30b7\u30a7\u30eb\u3042\u305f\u308a\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3068\u89e3\u91c8\u3055\u308c\u3066\u30a8\u30e9\u30fc\u306b\u306a\u3063\u3066\u3057\u307e\u3046\u3088\u3046\u306a\u306e\u3067\u3001\u8d77\u52d5\u30b7\u30a7\u30eb\u306e\u6307\u5b9a\u3082\u524d\u7f6e\u3059\u308b\u70b9\u306b\u6ce8\u610f\u3002<\/p>\n<p>\u6b21\u306b\u8fd4\u4fe1\u30d7\u30ed\u30b0\u30e9\u30e0 reply.php \u3068\u3057\u305f\uff08\u53c2\u8003\uff1a<a href=\"http:\/\/www.phppro.jp\/qa\/784\">PHP\u30d7\u30ed\uff01<\/a>\uff09\u3002PEAR::Mail\/mimeDecode.php\u3092\u4f7f\u3063\u3066php:\/\/stdin\u304b\u3089\u8aad\u307f\u8fbc\u3093\u3060\u30e1\u30fc\u30eb\u3092\u89e3\u6790\u3057\u3066\u3044\u308b\u3002<\/p>\n<div class=\"hl-surround\" style=\"height:280px;\"><div class=\"hl-main\"><pre>&lt;?php\r\nrequire_once(&quot;Mail\/mimeDecode.php&quot;);\r\n\r\n\/\/ \u30e1\u30fc\u30eb\u3092 stdin \u304b\u3089\u8aad\u307f\u8fbc\u3080\r\n$source = file_get_contents(&quot;php:\/\/stdin&quot;);\r\nif (!$source) exit;\r\n\r\n\/\/ \u30c7\u30b3\u30fc\u30c9\u8a2d\u5b9a\r\n$params['include_bodies'] = true;\r\n$params['decode_bodies'] = true;\r\n$params['decode_headers'] = true;\r\n\r\n\/\/ \u30c7\u30b3\u30fc\u30c0\u3092\u751f\u6210\u3057\u3001\u30c7\u30b3\u30fc\u30c9\u5b9f\u884c\r\n$decoder = new Mail_mimeDecode($source);\r\nlist($recipients, $headers, $body)=$decoder-&gt;getSendArray();\r\n$structure = $decoder-&gt;decode($params);\r\n\r\n\/\/ From\u30d8\u30c3\u30c0\u3092MIME\u30c7\u30b3\u30fc\u30c9\u3057\u53d6\u308a\u51fa\u3059\r\n$from = mb_convert_encoding(mb_decode_mimeheader($structure-&gt;headers['from']), mb_internal_encoding(), &quot;auto&quot;);\r\n\r\n\/\/ \u5143\u306e From \u3092\u8fd4\u4fe1\u5b9b\u5148\u306e To \u306b\u3059\u308b\r\n$to = $from;\r\n\/\/ \u9001\u4fe1\u8005\u8a2d\u5b9a\uff08\u9001\u4fe1\u5c02\u7528\u30a2\u30c9\u30ec\u30b9\uff08\u2190\u5b58\u5728\u3057\u306a\u3044\u30a2\u30c9\u30ec\u30b9\u3063\u3066\u3053\u3068\uff1f\uff09\u306b\u3057\u305f\u307b\u3046\u304c\u3088\u3044\uff1f\uff09\r\n$from = &quot;From: hoge@example.co.jp&quot;;\r\n\/\/ \u5143\u306e Subject \u306b Re: \u3092\u4ed8\u3051\u3066\u984c\u540d\u306b\u3059\u308b\r\n$title = mb_convert_encoding(&quot;Re: &quot;.$structure-&gt;headers['subject'], &quot;ISO-2022-JP&quot;);\r\n\/\/ \u3068\u308a\u3042\u3048\u305a\u5c4a\u3044\u305f Body \u306e\u6587\u5b57\u30b3\u30fc\u30c9\u3092\u5909\u63db\r\n$body= mb_convert_encoding($body, &quot;ISO-2022-JP&quot;);\r\n\/\/ \u5143\u306e Body \u306e\u524d\u306b\u8fd4\u4fe1\u30e1\u30c3\u30bb\u30fc\u30b8\u3068\u5f15\u7528\u7b26\u3092\u4ed8\u52a0\r\n$body = mb_convert_encoding(&quot;\u767b\u9332\u306f\u5b8c\u4e86\u3057\u307e\u3057\u305f\u3002&quot;, &quot;ISO-2022-JP&quot;) . &quot;\\n\\n&gt;&gt;&quot; . $body;\r\n\r\n\/\/ \u9001\u4fe1\u6642\u306e\u6f22\u5b57\u30b3\u30fc\u30c9\u8a2d\u5b9a\uff08\u3053\u306e\u3042\u305f\u308a\u3088\u304f\u308f\u304b\u3089\u3093\uff09\r\nmb_internal_encoding(&quot;ISO-2022-JP&quot;);\r\nmb_language(&quot;japanese&quot;);\r\n\r\n\/\/ \u9001\u4fe1\r\nmb_send_mail($to, $title, $body, $from);\r\n?&gt;<\/pre><\/div><\/div>\n<p>\u306a\u304a\u3001\/etc\/aliases \u306b\u3001\u8fd4\u4fe1\u30b9\u30af\u30ea\u30d7\u30c8\u306e\u307f\u3067\u306a\u304f\u3001\u30ab\u30f3\u30de\u533a\u5207\u308a\u3067\u8ee2\u9001\u30a2\u30c9\u30ec\u30b9\u5148\u3084\u5c4a\u3044\u305f\u30e1\u30fc\u30eb\u306e\u4fdd\u5b58\u30d5\u30a1\u30a4\u30eb\u3082\u540c\u6642\u306b\u6307\u5b9a\u3067\u304d\u308b\u3002<\/p>\n<div class=\"hl-surround\" style=\"height:16.8px;\"><div class=\"hl-main\"><pre>hoge: foo,\/home\/foo\/reply.log,&quot;|\/usr\/bin\/php \/home\/foo\/reply.php&quot;<\/pre><\/div><\/div>\n<p><b>\u30ea\u30f3\u30af<\/b><\/p>\n<ul>\n<li><a href=\"http:\/\/www.phppro.jp\/qa\/784\">\u7a7a\u30e1\u30fc\u30eb\u306b\u3088\u308b\u81ea\u52d5\u8fd4\u4fe1\u6a5f\u80fd\u3092\u3064\u3051\u305f\u3044\u306e\u3067\u3059\u304c\u30fb\u30fb &#8211; PHP\u30d7\u30ed\uff01Q&#038;A\u63b2\u793a\u677f<br \/>\n<\/a><\/p>\n<li><a href=\"http:\/\/dozo.matrix.jp\/pear\/index.php?PEAR%2FMail%2FMail_MimeDecode\">\u30e1\u30fc\u30eb\u5206\u89e3 PEAR :: Mail_mimeDecode Mail_Mime\u30d1\u30c3\u30b1\u30fc\u30b8 &#8211; PHP::PEAR &#8211; dozo PukiWiki<br \/>\n<\/a><\/p>\n<li><a href=\"http:\/\/www.stackasterisk.jp\/tech\/php\/php03_04.jsp\">PHP\u7b2c3\u56de\uff1aPHP\u5fdc\u7528(\u30e1\u30fc\u30eb\u9001\u4fe1)<br \/>\n<\/a><\/p>\n<li><a href=\"http:\/\/www.hayagui.com\/mail.html\">\u306f\u3084\u3050\u3044\/\u30e1\u30fc\u30eb\u306e\u8ee2\u9001\u3068\u81ea\u52d5\u8fd4\u4fe1<br \/>\n<\/a><\/p>\n<li><a href=\"http:\/\/my-server.homelinux.com\/emptymail.php\">\u81ea\u5b85\u30b5\u30fc\u30d0\u306e\u9053\u3057\u308b\u3079\u3010\u7a7a\u30e1\u30fc\u30eb\uff08\u81ea\u52d5\u8fd4\u4fe1\u30e1\u30fc\u30eb\uff09\u3011<br \/>\n<\/a><\/p>\n<li><a href=\"http:\/\/bizmakoto.jp\/bizid\/articles\/0706\/26\/news008.html\">\u7814\u4fee\u3067\u6559\u3048\u3066\u304f\u308c\u306a\u3044\uff01\uff1a\u7b2c3\u56de\u300c\u81ea\u52d5\u8fd4\u4fe1\u30e1\u30fc\u30eb\u304c\u201c\u5371\u967a\u201d\u306a\u7406\u7531\u300d &#8211; ITmedia Biz.ID<br \/>\n<\/a><\/p>\n<hr align=\"left\" width=\"300\">\n<li><a href=\"http:\/\/wiredvision.jp\/news\/200811\/2008111418.html\">\u30e1\u30fc\u30eb\u306e\u81ea\u52d5\u8fd4\u4fe1\u3067\u3001\u8aa4\u8a33\u304c\u9053\u8def\u6a19\u8b58\u306b | WIRED VISION<br \/>\n<\/a>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u5c4a\u3044\u305f\u30e1\u30fc\u30eb\u306b\u81ea\u52d5\u8fd4\u4fe1\u3059\u308b\u306b\u306f\u3001\/etc\/aliases\u306b\u53d7\u3051\u4ed8\u3051\u308b\u30a2\u30c9\u30ec\u30b9\u3092\u66f8\u304d\u3001\u305d\u3053\u306b\u5c4a\u3044\u305f\u30e1\u30fc\u30eb\u3092\u8fd4\u4fe1\u30d7\u30ed\u30b0\u30e9\u30e0\u3078\u30d1\u30a4\u30d7\u3067\u6e21\u3059\u3002 \u6b21\u306e\u3088\u3046\u306b\u306a\u308b\u3002\u307e\u305a\u3001\/etc\/aliases\u3078\u306e\u30d1\u30a4\u30d7\u8a2d\u5b9a hoge: &#038;quot [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[1],"tags":[151],"_links":{"self":[{"href":"http:\/\/mechsys.tec.u-ryukyu.ac.jp\/~oshiro\/SiteList\/wp-json\/wp\/v2\/posts\/1354"}],"collection":[{"href":"http:\/\/mechsys.tec.u-ryukyu.ac.jp\/~oshiro\/SiteList\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/mechsys.tec.u-ryukyu.ac.jp\/~oshiro\/SiteList\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/mechsys.tec.u-ryukyu.ac.jp\/~oshiro\/SiteList\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/mechsys.tec.u-ryukyu.ac.jp\/~oshiro\/SiteList\/wp-json\/wp\/v2\/comments?post=1354"}],"version-history":[{"count":3,"href":"http:\/\/mechsys.tec.u-ryukyu.ac.jp\/~oshiro\/SiteList\/wp-json\/wp\/v2\/posts\/1354\/revisions"}],"predecessor-version":[{"id":1356,"href":"http:\/\/mechsys.tec.u-ryukyu.ac.jp\/~oshiro\/SiteList\/wp-json\/wp\/v2\/posts\/1354\/revisions\/1356"}],"wp:attachment":[{"href":"http:\/\/mechsys.tec.u-ryukyu.ac.jp\/~oshiro\/SiteList\/wp-json\/wp\/v2\/media?parent=1354"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/mechsys.tec.u-ryukyu.ac.jp\/~oshiro\/SiteList\/wp-json\/wp\/v2\/categories?post=1354"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/mechsys.tec.u-ryukyu.ac.jp\/~oshiro\/SiteList\/wp-json\/wp\/v2\/tags?post=1354"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}