{"id":41,"date":"2014-09-14T18:37:00","date_gmt":"2014-09-14T09:37:00","guid":{"rendered":"http:\/\/arat.xyz\/wordpress\/?p=41"},"modified":"2015-05-10T04:43:32","modified_gmt":"2015-05-09T19:43:32","slug":"%e3%83%a1%e3%83%bc%e3%83%ab%e9%80%81%e4%bf%a1%e3%82%b9%e3%82%af%e3%83%aa%e3%83%97%e3%83%88","status":"publish","type":"post","link":"https:\/\/www.arat.xyz\/wordpress\/?p=41","title":{"rendered":"\u30e1\u30fc\u30eb\u9001\u4fe1\u30b9\u30af\u30ea\u30d7\u30c8"},"content":{"rendered":"<p> Linux\u306e\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u304b\u3089\u30e1\u30fc\u30eb\u3092\u9001\u4fe1\u3059\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u6210\uff08\u6b63\u3057\u304f\u306fweb\u306e\u5185\u5bb9\u3092\u6539\u5909\uff09\u3057\u305f\u3002 <\/p>\n<ul class=\"org-ul\">\n<li>\u6dfb\u4ed8\u30d5\u30a1\u30a4\u30eb\u53ef\u80fd\uff080\u3067\u3082\u8907\u6570\u3067\u3082\uff09\n<\/li>\n<\/ul>\n<p> \u4f7f\u7528\u3059\u308b\u6a5f\u4f1a\u306f\u4eca\u306e\u6240\u307b\u3068\u3093\u3069\u306a\u3044\u3068\u601d\u3046\u2026\u2026 <\/p>\n<p> \u8a73\u3057\u304f\u306fwiki\u3067\u3002 <\/p>\n<div class=\"org-src-container\">\n<pre class=\"src src-sh\"><span style=\"color: #656565;\">#<\/span><span style=\"color: #757575;\">!\/bin\/<\/span><span style=\"color: #5180b3;\">bash<\/span>\n\n<span style=\"color: #656565;\">############################<\/span>\n<span style=\"color: #656565;\">## <\/span><span style=\"color: #757575;\">&#12513;&#12540;&#12523;&#28155;&#20184;&#12501;&#12449;&#12452;&#12523;&#12473;&#12463;&#12522;&#12503;&#12488;<\/span>\n<span style=\"color: #656565;\">## <\/span><span style=\"color: #757575;\">&#12467;&#12510;&#12531;&#12489;&#12521;&#12452;&#12531;&#12363;&#12425;&#28155;&#20184;&#20184;&#12365;&#12513;&#12540;&#12523;&#12434;&#36865;&#20449;&#12377;&#12427;&#12473;&#12463;&#12522;&#12503;&#12488;&#12391;&#12377;.<\/span>\n<span style=\"color: #656565;\">##<\/span>\n<span style=\"color: #656565;\">## <\/span><span style=\"color: #757575;\">send_mail.sh {to&#12450;&#12489;&#12524;&#12473;} {&#12479;&#12452;&#12488;&#12523;} {&#26412;&#25991;&#12501;&#12449;&#12452;&#12523;} [{&#28155;&#20184;&#12501;&#12449;&#12452;&#12523;&#21517;}...]<\/span>\n<span style=\"color: #656565;\">##<\/span>\n<span style=\"color: #656565;\">############################<\/span>\n\n<span style=\"color: #656565;\">## <\/span><span style=\"color: #757575;\">Init section<\/span>\n<span style=\"color: #baba36;\">from_addr<\/span>=<span style=\"color: #bdbc61;\">'ara_t@po.mdu.ac.jp'<\/span>\n<span style=\"color: #baba36;\">to_addr<\/span>=$<span style=\"color: #baba36;\">1<\/span>\n<span style=\"color: #baba36;\">subject<\/span>=<span style=\"color: #fa8072;\">`echo $2 | nkf -w -Lu`<\/span>\n<span style=\"color: #baba36;\">mail<\/span>=<span style=\"color: #fa8072;\">`cat $3 | nkf -w -Lu`<\/span>\n<span style=\"color: #528fd1;\">shift<\/span>; <span style=\"color: #528fd1;\">shift<\/span>; <span style=\"color: #528fd1;\">shift<\/span>\n<span style=\"color: #baba36;\">boundary<\/span>=<span style=\"color: #fa8072;\">`date +%Y%m%d%H%M%N`<\/span>\n\n<span style=\"color: #656565;\">## <\/span><span style=\"color: #757575;\">generate MIME encoded mail<\/span>\n<span style=\"color: #528fd1;\">echo<\/span> <span style=\"color: #bdbc61;\">\"From: $from_addr\"<\/span> &gt; .MIME_MAIL.tmp\n<span style=\"color: #528fd1;\">echo<\/span> <span style=\"color: #bdbc61;\">\"To: $to_addr\"<\/span> &gt;&gt; .MIME_MAIL.tmp\n<span style=\"color: #528fd1;\">echo<\/span> <span style=\"color: #bdbc61;\">\"Subject: $subject\"<\/span> &gt;&gt; .MIME_MAIL.tmp\n<span style=\"color: #528fd1;\">echo<\/span> <span style=\"color: #bdbc61;\">\"MIME-Version: 1.0\"<\/span> &gt;&gt; .MIME_MAIL.tmp\n<span style=\"color: #528fd1;\">echo<\/span> <span style=\"color: #bdbc61;\">\"Content-type: multipart\/mixed; boundary=\\\"----$boundary\\\"\"<\/span> &gt;&gt; .MIME_MAIL.tmp\n<span style=\"color: #528fd1;\">echo<\/span> <span style=\"color: #bdbc61;\">\"Content-Transfer-Encoding: 7bit\"<\/span> &gt;&gt; .MIME_MAIL.tmp\n<span style=\"color: #528fd1;\">echo<\/span> <span style=\"color: #bdbc61;\">\"\"<\/span> &gt;&gt; .MIME_MAIL.tmp\n<span style=\"color: #528fd1;\">echo<\/span> <span style=\"color: #bdbc61;\">\"This is a multi-part message in MIME format.\"<\/span> &gt;&gt; .MIME_MAIL.tmp\n<span style=\"color: #528fd1;\">echo<\/span> <span style=\"color: #bdbc61;\">\"\"<\/span> &gt;&gt; .MIME_MAIL.tmp\n\n<span style=\"color: #656565;\">## <\/span><span style=\"color: #757575;\">Insert MAIL_BODY (if you need)<\/span>\n<span style=\"color: #528fd1;\">echo<\/span> <span style=\"color: #bdbc61;\">\"------$boundary\"<\/span> &gt;&gt; .MIME_MAIL.tmp\n<span style=\"color: #528fd1;\">echo<\/span> <span style=\"color: #bdbc61;\">\"Content-type: text\/plain; charset=utf-8\"<\/span> &gt;&gt; .MIME_MAIL.tmp\n<span style=\"color: #528fd1;\">echo<\/span> <span style=\"color: #bdbc61;\">\"Content-Transfer-Encoding: 7bit\"<\/span> &gt;&gt; .MIME_MAIL.tmp\n<span style=\"color: #528fd1;\">echo<\/span> <span style=\"color: #bdbc61;\">\"\"<\/span> &gt;&gt; .MIME_MAIL.tmp\n<span style=\"color: #528fd1;\">echo<\/span> <span style=\"color: #bdbc61;\">\"$mail\"<\/span> &gt;&gt; .MIME_MAIL.tmp\n<span style=\"color: #528fd1;\">echo<\/span> <span style=\"color: #bdbc61;\">\"\"<\/span> &gt;&gt; .MIME_MAIL.tmp\n\n<span style=\"color: #656565;\">## <\/span><span style=\"color: #757575;\">Attach file to E-Mail<\/span>\n<span style=\"color: #5180b3;\">while<\/span> [ $<span style=\"color: #baba36;\">#<\/span> -ge 1 ] ; <span style=\"color: #5180b3;\">do<\/span>\n  <span style=\"color: #baba36;\">attach_file<\/span>=$<span style=\"color: #baba36;\">1<\/span>\n  <span style=\"color: #baba36;\">filename<\/span>=<span style=\"color: #fa8072;\">`echo $attach_file | sed -e \"s\/.*\\\/\\(.*$\\)\/\\1\/\"`<\/span>\n  <span style=\"color: #baba36;\">content_type<\/span>=<span style=\"color: #fa8072;\">`file --mime $attach_file | cut -d' ' -f2`<\/span>\n  <span style=\"color: #528fd1;\">echo<\/span> <span style=\"color: #bdbc61;\">\"------$boundary\"<\/span> &gt;&gt; .MIME_MAIL.tmp\n  <span style=\"color: #528fd1;\">echo<\/span> <span style=\"color: #bdbc61;\">\"Content-type: $content_type\"<\/span> &gt;&gt; .MIME_MAIL.tmp\n  <span style=\"color: #528fd1;\">echo<\/span> <span style=\"color: #bdbc61;\">\" name=$filename\"<\/span> &gt;&gt; .MIME_MAIL.tmp\n  <span style=\"color: #528fd1;\">echo<\/span> <span style=\"color: #bdbc61;\">\"Content-Transfer-Encoding: base64\"<\/span> &gt;&gt; .MIME_MAIL.tmp\n  <span style=\"color: #528fd1;\">echo<\/span> <span style=\"color: #bdbc61;\">\"Content-Disposition : attachment;\"<\/span> &gt;&gt; .MIME_MAIL.tmp\n  <span style=\"color: #528fd1;\">echo<\/span> <span style=\"color: #bdbc61;\">\" filename=$filename\"<\/span> &gt;&gt; .MIME_MAIL.tmp\n  <span style=\"color: #528fd1;\">echo<\/span> <span style=\"color: #bdbc61;\">\"\"<\/span> &gt;&gt; .MIME_MAIL.tmp\n  cat $<span style=\"color: #baba36;\">filename<\/span> | base64 &gt;&gt; .MIME_MAIL.tmp\n  <span style=\"color: #528fd1;\">echo<\/span> <span style=\"color: #bdbc61;\">\"\"<\/span> &gt;&gt; .MIME_MAIL.tmp\n  <span style=\"color: #528fd1;\">shift<\/span>\n<span style=\"color: #5180b3;\">done<\/span>\n<span style=\"color: #528fd1;\">echo<\/span> <span style=\"color: #bdbc61;\">\"------$boundary--\"<\/span> &gt;&gt; .MIME_MAIL.tmp\n\n<span style=\"color: #656565;\">## <\/span><span style=\"color: #757575;\">Send E-Mail<\/span>\n\/usr\/sbin\/sendmail -i $<span style=\"color: #baba36;\">to_addr<\/span> &lt; .MIME_MAIL.tmp\n\n<span style=\"color: #656565;\">## <\/span><span style=\"color: #757575;\">Delete TEMP file<\/span>\nrm -f .MIME_MAIL.tmp\n\n<span style=\"color: #5180b3;\">exit<\/span> 0\n<\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Linux\u306e\u30b3\u30de\u30f3\u30c9\u30e9\u30a4\u30f3\u304b\u3089\u30e1\u30fc\u30eb\u3092\u9001\u4fe1\u3059\u308b\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u4f5c\u6210\uff08\u6b63\u3057\u304f\u306fweb\u306e\u5185\u5bb9\u3092\u6539\u5909\uff09\u3057\u305f\u3002 \u6dfb\u4ed8\u30d5\u30a1\u30a4\u30eb\u53ef\u80fd\uff080\u3067\u3082\u8907\u6570\u3067\u3082\uff09 \u4f7f\u7528\u3059\u308b\u6a5f\u4f1a\u306f\u4eca\u306e\u6240\u307b\u3068\u3093\u3069\u306a\u3044\u3068\u601d\u3046\u2026\u2026 \u8a73\u3057\u304f\u306fwiki\u3067\u3002 #!\/bin\/ba<\/p><\/div>\n<div class=\"blog-btn\"><a href=\"https:\/\/www.arat.xyz\/wordpress\/?p=41\" class=\"home-blog-btn\">\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[8],"tags":[9,10],"_links":{"self":[{"href":"https:\/\/www.arat.xyz\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/41"}],"collection":[{"href":"https:\/\/www.arat.xyz\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.arat.xyz\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.arat.xyz\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.arat.xyz\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=41"}],"version-history":[{"count":1,"href":"https:\/\/www.arat.xyz\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/41\/revisions"}],"predecessor-version":[{"id":42,"href":"https:\/\/www.arat.xyz\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/41\/revisions\/42"}],"wp:attachment":[{"href":"https:\/\/www.arat.xyz\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=41"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.arat.xyz\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=41"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.arat.xyz\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=41"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}