{"id":1732,"date":"2015-02-20T13:24:41","date_gmt":"2015-02-20T04:24:41","guid":{"rendered":"http:\/\/blog.sensuishi.net\/?p=1732"},"modified":"2015-02-20T13:24:41","modified_gmt":"2015-02-20T04:24:41","slug":"post-1732","status":"publish","type":"post","link":"https:\/\/blog.sensuishi.net\/?p=1732","title":{"rendered":"05 postfix gmail relay\u8a2d\u5b9a"},"content":{"rendered":"<p>MTA\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u8b66\u544a\u30e1\u30fc\u30eb\u306a\u3069\u3092\u9001\u4fe1\u3067\u304d\u308b\u69d8\u306b\u3057\u307e\u3059\u3002<\/p>\n<p>\u307e\u305a\u306f\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<br \/>\nsudo apt-get install postfix<\/p>\n<p>\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u30b3\u30d4\u30fc<br \/>\nsudo cp \/usr\/lib\/postfix\/main.cf \/etc\/postfix\/<\/p>\n<p>\u30b3\u30f3\u30d5\u30a3\u30b0<br \/>\nsudo vi \/etc\/postfix\/main.cf<\/p>\n<p>myorigin = $myhostname<br \/>\ninet_interfaces = all<br \/>\nmydestination = $myhostname, localhost.$mydomain, localhost, $mydomain<br \/>\nunknown_local_recipient_reject_code = 550<br \/>\nmynetworks = 127.0.0.0\/8<br \/>\nsmtpd_banner = $myhostname ESMTP $mail_name (@@DISTRO@@)<br \/>\nsendmail_path =  \/usr\/sbin\/sendmail<br \/>\nnewaliases_path = \/usr\/bin\/newaliases<br \/>\nmailq_path = \/usr\/bin\/mailq.postfix<br \/>\nhtml_directory = no<br \/>\nmanpage_directory = \/usr\/share\/man<br \/>\nsample_directory = \/etc\/postfix<\/p>\n<p>readme_directory = \/usr\/share\/doc\/postfix<br \/>\ninet_protocols = ipv4<br \/>\nrelayhost = [smtp.gmail.com]:587<br \/>\nsender_canonical_maps = regexp:\/etc\/postfix\/canonical<br \/>\nsmtp_sasl_auth_enable = yes<br \/>\nsmtp_sasl_password_maps = hash:\/etc\/postfix\/relay_password<br \/>\nsmtp_sasl_mechanism_filter = cram-md5, login, plain<br \/>\nsmtp_tls_policy_maps = hash:\/etc\/postfix\/tls_policy<br \/>\nsmtp_use_tls = yes<br \/>\nsmtp_sasl_security_options = noanonymous<\/p>\n<p>\u30ea\u30ec\u30fc\u7528\u30a2\u30ab\u30a6\u30f3\u30c8\u3092\u8a2d\u5b9a<br \/>\nsudo vi \/etc\/postfix\/relay_password<br \/>\nsmtp.gmail.com foo@gmail.com:password<\/p>\n<p>root\u4ee5\u5916\u8aad\u3081\u306a\u3044\u69d8\u306b\u5909\u66f4<br \/>\nsudo chmod 400 \/etc\/postfix\/relay_password<\/p>\n<p>hash\u3092\u4f5c\u6210<br \/>\nsudo postmap hash:\/etc\/postfix\/relay_password<\/p>\n<p>from\u30a2\u30c9\u30ec\u30b9\u3092gmail\u306e\u30a2\u30c9\u30ec\u30b9\u306b\u5909\u66f4\u3059\u308b<br \/>\nsudo vi \/etc\/postfix\/canonical<\/p>\n<p>\/.*\/ foo@gmail.com<\/p>\n<p>postfix\u8d77\u52d5<br \/>\nsudo \/etc\/init.d\/postfix start<\/p>\n<p>\u30c6\u30b9\u30c8\u30e1\u30fc\u30eb\u9001\u4fe1<br \/>\nmail foo@gmail.com -s &#8220;test mail&#8221;<br \/>\nCC:(\u8ffd\u52a0\u53ef\u80fd)<br \/>\nbody<br \/>\nctrl+d\u3067\u9001\u4fe1<\/p>\n<p>log\u3092\u78ba\u8a8d<br \/>\ntail \/var\/log\/mail.log<\/p>\n","protected":false},"excerpt":{"rendered":"<p>MTA\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u8b66\u544a\u30e1\u30fc\u30eb\u306a\u3069\u3092\u9001\u4fe1\u3067\u304d\u308b\u69d8\u306b\u3057\u307e\u3059\u3002 \u307e\u305a\u306f\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb sudo apt-get install postfix \u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u30b3\u30d4\u30fc sudo cp \/usr\/lib\/postfix\/main [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1733,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[130,19],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.sensuishi.net\/index.php?rest_route=\/wp\/v2\/posts\/1732"}],"collection":[{"href":"https:\/\/blog.sensuishi.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.sensuishi.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.sensuishi.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.sensuishi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1732"}],"version-history":[{"count":1,"href":"https:\/\/blog.sensuishi.net\/index.php?rest_route=\/wp\/v2\/posts\/1732\/revisions"}],"predecessor-version":[{"id":1734,"href":"https:\/\/blog.sensuishi.net\/index.php?rest_route=\/wp\/v2\/posts\/1732\/revisions\/1734"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.sensuishi.net\/index.php?rest_route=\/wp\/v2\/media\/1733"}],"wp:attachment":[{"href":"https:\/\/blog.sensuishi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1732"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.sensuishi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1732"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.sensuishi.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1732"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}