{"id":8192,"date":"2017-07-19T12:18:59","date_gmt":"2017-07-19T03:18:59","guid":{"rendered":"https:\/\/sendgrid.kke.co.jp\/blog\/?p=8192"},"modified":"2022-08-08T13:15:10","modified_gmt":"2022-08-08T04:15:10","slug":"postfix%e3%81%8b%e3%82%89sendgrid%e3%81%b8%e3%81%ae%e3%83%aa%e3%83%ac%e3%83%bc%e3%82%92%e3%82%ab%e3%82%b9%e3%82%bf%e3%83%9e%e3%82%a4%e3%82%ba%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/sendgrid.kke.co.jp\/blog\/?p=8192","title":{"rendered":"Postfix\u304b\u3089SendGrid\u3078\u306e\u30ea\u30ec\u30fc\u3092\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3059\u308b"},"content":{"rendered":"<h3>\u306f\u3058\u3081\u306b<\/h3>\n<p>\u4eca\u56de\u306f\u3001SendGrid\u3092SMTP\u306e\u30ea\u30ec\u30fc\u30b5\u30fc\u30d0\u3068\u3057\u3066\u5229\u7528\u3059\u308b\u969b\u306e\u30c6\u30af\u30cb\u30c3\u30af\u3092\u3044\u304f\u3064\u304b\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002\u6b21\u306e\u3088\u3046\u306a\u8ab2\u984c\u89e3\u6c7a\u306e\u30d2\u30f3\u30c8\u306b\u306a\u308c\u3070\u5e78\u3044\u3067\u3059\u3002<\/p>\n<ul>\n<li><strong>\u30b1\u30fc\u30b91\uff1a\u5b9b\u5148\u30c9\u30e1\u30a4\u30f3\u6bce\u306e\u30ea\u30ec\u30fc\u5236\u5fa1<\/strong><br \/>\n\u4f8b\u3048\u3070\u3001\u7279\u5b9a\u30c9\u30e1\u30a4\u30f3\u5b9b\u306e\u30e1\u30fc\u30eb\u306e\u307fSendGrid\u3092\u7d4c\u7531\u3057\u3066\u9001\u4fe1\u3057\u3001\u4ed6\u306e\u30c9\u30e1\u30a4\u30f3\u5b9b\u306e\u30e1\u30fc\u30eb\u306b\u3064\u3044\u3066\u306f\u3001\u81ea\u524d\u306e\u30e1\u30fc\u30eb\u30b5\u30fc\u30d0\u304b\u3089\u76f4\u63a5\u9001\u4fe1\u3059\u308b\u3068\u3044\u3063\u305f\u30b1\u30fc\u30b9\u3067\u3059\u3002<\/li>\n<li><strong>\u30b1\u30fc\u30b92\uff1aSendGrid\u3078\u79fb\u884c\u6642\u306e\u30a6\u30a9\u30fc\u30e0\u30a2\u30c3\u30d7<\/strong><br \/>\n\u65e2\u306b\u81ea\u524d\u306e\u30e1\u30fc\u30eb\u30b5\u30fc\u30d0\u304b\u3089\u5927\u91cf\u306e\u30e1\u30fc\u30eb\u3092\u7d99\u7d9a\u7684\u306b\u9001\u4fe1\u3057\u3066\u3044\u308b\u72b6\u614b\u304b\u3089SendGrid\u7d4c\u7531\u3067\u306e\u9001\u4fe1\u306b\u5207\u308a\u66ff\u3048\u308b\u5834\u5408\u3001\u5168\u30c8\u30e9\u30d5\u30a3\u30c3\u30af\u3092\u3044\u304d\u306a\u308aSendGrid\u7d4c\u7531\u3067\u9001\u4fe1\u3059\u308b\u3068\u30a6\u30a9\u30fc\u30e0\u30a2\u30c3\u30d7\u4e0d\u5341\u5206\u306e\u305f\u3081\u914d\u4fe1\u30c8\u30e9\u30d6\u30eb\u306b\u9665\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u3046\u3044\u3063\u305f\u30c8\u30e9\u30d6\u30eb\u3092\u907f\u3051\u308b\u305f\u3081\u306b\u3001\u306f\u3058\u3081\u306fSendGrid\u7d4c\u7531\u306e\u30e1\u30fc\u30eb\u3092\u5236\u9650\u3057\u3001\u5f90\u3005\u306b\u305d\u306e\u5272\u5408\u3092\u5897\u3084\u3059\u3053\u3068\u3092\u76ee\u7684\u3068\u3057\u305f\u30b1\u30fc\u30b9\u3067\u3059\u3002<\/li>\n<li><strong>\u30b1\u30fc\u30b93\uff1aSendGrid\u4ee5\u5916\u306b\u8907\u6570\u306e\u30e1\u30fc\u30eb\u914d\u4fe1\u30b5\u30fc\u30d3\u30b9\u3092\u5229\u7528\u3057\u53ef\u7528\u6027\u3092\u5411\u4e0a\u3059\u308b<\/strong><br \/>\nSendGrid\u542b\u3081\u8907\u6570\u306e\u30e1\u30fc\u30eb\u914d\u4fe1\u30b5\u30fc\u30d3\u30b9\u7d4c\u7531\u3067\u9001\u4fe1\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u3066\u304a\u304d\u3001\u7279\u5b9a\u306e\u914d\u4fe1\u30b5\u30fc\u30d3\u30b9\u304c\u5229\u7528\u3067\u304d\u306a\u3044\u5834\u5408\u306b\u81ea\u52d5\u7684\u306b\u5225\u306e\u914d\u4fe1\u30b5\u30fc\u30d3\u30b9\u306b\u5207\u308a\u66ff\u3048\u308b\u3053\u3068\u3092\u76ee\u7684\u3068\u3057\u305f\u30b1\u30fc\u30b9\u3067\u3059\u3002<\/li>\n<\/ul>\n<p>\u5bfe\u8c61\u3068\u3057\u3066\u3044\u308b\u30e1\u30fc\u30eb\u30b5\u30fc\u30d0\u306fPostfix\u3067\u3001Ubuntu\u3092\u4f7f\u3063\u3066\u74b0\u5883\u69cb\u7bc9\u3057\u307e\u3057\u305f\u3002\u307e\u305f\u3001\u30b1\u30fc\u30b92\u30683\u3067\u306f\u30ea\u30ec\u30fc\u5148\u3092\u5236\u5fa1\u3059\u308b\u306e\u306bbind\u3068\u3044\u3046DNS\u3092\u5229\u7528\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<aside class=\"status\">\nSendGrid\u5916\u306e\u30c4\u30fc\u30eb\u3067\u3042\u308bPostfix\u3084bind\u306b\u95a2\u3057\u3066\u306f\u5f53\u793e\u30b5\u30dd\u30fc\u30c8\u5bfe\u8c61\u5916\u3068\u306a\u3063\u3066\u304a\u308a\u307e\u3059\u306e\u3067\u3001\u7d30\u304b\u306a\u8a2d\u5b9a\u306b\u95a2\u3057\u3066\u306f\u3054\u81ea\u8eab\u306b\u3066\u304a\u8abf\u3079\u304f\u3060\u3055\u3044\u3002<br \/>\n\u672c\u8a18\u4e8b\u3067\u306f\u30ea\u30ec\u30fc\u5236\u5fa1\u306b\u5fc5\u8981\u306a\u6700\u4f4e\u9650\u306e\u8a2d\u5b9a\u306e\u307f\u3092\u3054\u7d39\u4ecb\u3057\u3066\u3044\u307e\u3059\u3002\u30a2\u30af\u30bb\u30b9\u5236\u5fa1\u3084\u30ea\u30ec\u30fc\u8a2d\u5b9a\u3092\u8aa4\u308b\u3068\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u4e8b\u6545\u306e\u30ea\u30b9\u30af\u304c\u3042\u308b\u305f\u3081\u3001\u5341\u5206\u306b\u3054\u6ce8\u610f\u304f\u3060\u3055\u3044\u3002<br \/>\n<\/aside>\n<h3>\u30b1\u30fc\u30b91\uff1a\u5b9b\u5148\u30c9\u30e1\u30a4\u30f3\u6bce\u306e\u30ea\u30ec\u30fc\u5236\u5fa1<\/h3>\n<h5>1. \u69cb\u6210\u30a4\u30e1\u30fc\u30b8<\/h5>\n<p>\u5b9b\u5148\u30c9\u30e1\u30a4\u30f3\u6bce\u306e\u30ea\u30ec\u30fc\u5148\u5236\u5fa1\u306fPostfix\u5358\u4f53\u3067\u5b9f\u73fe\u3067\u304d\u307e\u3059\u3002\u4ee5\u964d\u306e\u8aac\u660e\u306f\u3059\u3079\u3066Postfix\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u30db\u30b9\u30c8\u4e0a\u3067\u306e\u8a2d\u5b9a\u3067\u3059\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2017\/07\/1.png\" alt=\"\u30b1\u30fc\u30b91\uff1a\u5b9b\u5148\u30c9\u30e1\u30a4\u30f3\u6bce\u306e\u30ea\u30ec\u30fc\u5236\u5fa1\" width=\"100%\" class=\"alignnone size-full wp-image-8204\" srcset=\"https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2017\/07\/1.png 1280w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2017\/07\/1-300x185.png 300w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2017\/07\/1-768x474.png 768w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2017\/07\/1-1024x632.png 1024w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2017\/07\/1-592x366.png 592w\" sizes=\"(max-width: 1280px) 100vw, 1280px\" \/><\/p>\n<h5>2. main.cf\u306e\u7de8\u96c6<\/h5>\n<p><strong>\/etc\/postfix\/main.cf<\/strong>\u30d5\u30a1\u30a4\u30eb\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n# SASL\u8a8d\u8a3c\u8a2d\u5b9a\u6709\u52b9\u5316\r\nsmtp_sasl_auth_enable = yes\r\n# \u533f\u540d\u30ed\u30b0\u30a4\u30f3\u3092\u8a31\u53ef\u3057\u306a\u3044\r\nsmtp_sasl_security_options = noanonymous\r\n# \u65e5\u548c\u898bTLS\r\nsmtp_tls_security_level = may            \r\n# \u30c9\u30e1\u30a4\u30f3\u6bce\u306e\u30ea\u30ec\u30fc\u5148\u8a2d\u5b9a\r\ntransport_maps = hash:\/etc\/postfix\/transport\r\n# \u30ea\u30ec\u30fc\u5148\u6bce\u306eSMTP\u8a8d\u8a3c\u60c5\u5831\r\nsmtp_sasl_password_maps = hash:\/etc\/postfix\/relay_password\r\n<\/pre>\n<h5>3. \u5b9b\u5148\u30c9\u30e1\u30a4\u30f3\u6bce\u30ea\u30ec\u30fc\u5148\u8a2d\u5b9a<\/h5>\n<p><strong>\/etc\/postfix\/transport<\/strong>\u30d5\u30a1\u30a4\u30eb\u306b\u30c9\u30e1\u30a4\u30f3\u6bce\u306e\u30ea\u30ec\u30fc\u5148\u8a2d\u5b9a\u3092\u884c\u3044\u307e\u3059\u3002\u4ee5\u4e0b\u306e\u8a2d\u5b9a\u3067\u306f\u3001\u5b9b\u5148\u30c9\u30e1\u30a4\u30f3\u304c\u300c@sink.sendgrid.net\u300d\u306e\u5834\u5408\u306bSendGrid\u306b\u30ea\u30ec\u30fc\uff081\u884c\u76ee\uff09\u3057\u3001\u305d\u306e\u4ed6\u306e\u5b9b\u5148\u306b\u3064\u3044\u3066\u306f\u30ea\u30ec\u30fc\u305b\u305a\u306b\u76f4\u63a5\u9001\u4fe1\uff082\u884c\u76ee\uff09\u3092\u884c\u3044\u307e\u3059\u3002\uff11\u884c\u76ee\u3092\u53c2\u8003\u306b\u3057\u3066\u5b9b\u5148\u30c9\u30e1\u30a4\u30f3\u3068\u305d\u306e\u30ea\u30ec\u30fc\u5148\u8a2d\u5b9a\u3092\u8ffd\u52a0\u3057\u3066\u3044\u304f\u3053\u3068\u3067SendGrid\u7d4c\u7531\u3067\u30ea\u30ec\u30fc\u3059\u308b\u5b9b\u5148\u30c9\u30e1\u30a4\u30f3\u3092\u5897\u3084\u3057\u3066\u3044\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nsink.sendgrid.net       smtp:&#x5B;smtp.sendgrid.net]:587\r\n*                       :\r\n<\/pre>\n<h5>4. \u30ea\u30ec\u30fc\u5148\u6bce\u306eSMTP\u8a8d\u8a3c\u8a2d\u5b9a<\/h5>\n<p><strong>\/etc\/postfix\/relay_password<\/strong>\u30d5\u30a1\u30a4\u30eb\u306bSMTP\u8a8d\u8a3c\u3092\u5fc5\u8981\u3068\u3059\u308b\u30ea\u30ec\u30fc\u5148\u306e\u305f\u3081\u306b\u8a8d\u8a3c\u60c5\u5831\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002SendGrid\u306e<a href=\"https:\/\/support.sendgrid.kke.co.jp\/hc\/ja\/articles\/204187885\" target=\"_blank\">SMTP\u8a8d\u8a3c\u60c5\u5831<\/a>\u3068\u3057\u3066\u30e1\u30fc\u30eb\u9001\u4fe1\u30d1\u30fc\u30df\u30c3\u30b7\u30e7\u30f3\u3092\u6301\u3063\u305f<a href=\"https:\/\/sendgrid.kke.co.jp\/docs\/Tutorials\/A_Transaction_Mail\/manage_api_key.html\" target=\"_blank\">API\u30ad\u30fc<\/a>\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3092\u304a\u52e7\u3081\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n&#x5B;smtp.sendgrid.net]:587 apikey:SendGrid\u306eAPI\u30ad\u30fc\r\n<\/pre>\n<h5>5. \u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u306e\u30cf\u30c3\u30b7\u30e5\u5316<\/h5>\n<p>3\u30684\u3067\u4f5c\u6210\u3057\u305f\u8a2d\u5b9a\u30d5\u30a1\u30a4\u30eb\u3092\u305d\u308c\u305e\u308c\u30cf\u30c3\u30b7\u30e5\u5316\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ sudo postmap \/etc\/postfix\/transport\r\n$ sudo postmap \/etc\/postfix\/relay_password\r\n<\/pre>\n<h5>6. Postfix\u306e\u518d\u8d77\u52d5<\/h5>\n<p>Postfix\u3092\u518d\u8d77\u52d5\u3057\u3066\u8a2d\u5b9a\u3092\u53cd\u6620\u3055\u305b\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ sudo postfix stop\r\n$ sudo postfix start\r\n<\/pre>\n<p>\u4ee5\u4e0a\u3067\u8a2d\u5b9a\u5b8c\u4e86\u3067\u3059\u3002<\/p>\n<h5>7. \u52d5\u4f5c\u78ba\u8a8d<\/h5>\n<p>\u52d5\u4f5c\u78ba\u8a8d\u3092\u884c\u3046\u305f\u3081\u3001mail\u30b3\u30de\u30f3\u30c9\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3066\u6b21\u306e\u3088\u3046\u306b\u30e1\u30fc\u30eb\u3092\u9001\u4fe1\u3057\u307e\u3059\u3002\u30e1\u30fc\u30eb\u306e\u30ea\u30ec\u30fc\u7d4c\u8def\u306f\u3001\u53d7\u4fe1\u3057\u305f\u30e1\u30fc\u30eb\u30d8\u30c3\u30c0\u3067\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002SendGrid\u7d4c\u7531\u3067\u30ea\u30ec\u30fc\u3057\u305f\u3082\u306e\u306f<a href=\"https:\/\/sendgrid.kke.co.jp\/docs\/User_Manual_JP\/email_activity.html\" target=\"_blank\">\u30c0\u30c3\u30b7\u30e5\u30dc\u30fc\u30c9\u306eActivity<\/a>\u4e0a\u306b\u3082\u8868\u793a\u3055\u308c\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ sudo apt-get install mailutils\r\n$ echo &quot;Hello sink&quot; | mail -s &quot;Hello sink&quot; -aFrom:from@example.com to@sink.sendgrid.net\r\n$ echo &quot;Hello kke&quot; | mail -s &quot;Hello kke&quot; -aFrom:from@example.com to@kke.co.jp\r\n<\/pre>\n<h3>\u30b1\u30fc\u30b92\uff1aSendGrid\u3078\u79fb\u884c\u6642\u306e\u30a6\u30a9\u30fc\u30e0\u30a2\u30c3\u30d7<\/h3>\n<h5>1. \u69cb\u6210\u30a4\u30e1\u30fc\u30b8<\/h5>\n<p>\u4eca\u56de\u306f\u3001\u540c\u4e00\u512a\u5148\u5ea6\u306eMX\u30ec\u30b3\u30fc\u30c9\u3092\u8907\u6570\u7528\u610f\u3057\u3066\u3001Postfix\u304c\u30e9\u30f3\u30c0\u30e0\u914d\u9001\u3059\u308b\u4ed5\u7d44\u307f\u3092\u5229\u7528\u3057\u3066\u30ea\u30ec\u30fc\u5148\u3092\u5206\u6563\u3057\u307e\u3059\u3002\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u69cb\u6210\u306b\u3057\u307e\u3059\u3002<\/p>\n<ul>\n<li><strong>mail<\/strong><br \/>\n\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u304b\u3089\u306e\u30e1\u30fc\u30eb\u9001\u4fe1\u30ea\u30af\u30a8\u30b9\u30c8\u3092\u53d7\u3051\u4ed8\u3051\u307e\u3059\u3002\u307e\u305f\u3001\u30ed\u30fc\u30ab\u30eb\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305fbind\u304b\u3089MX\u30ec\u30b3\u30fc\u30c9\u3092\u53c2\u7167\u3057\u3066relay1\u307e\u305f\u306frelay2\u306b\u30e1\u30fc\u30eb\u3092\u30ea\u30ec\u30fc\u3057\u307e\u3059\u3002\u30d1\u30d6\u30ea\u30c3\u30af\u306aDNS\u30b5\u30fc\u30d3\u30b9\u3092\u5229\u7528\u3057\u3066\u3082\u826f\u3044\u306e\u3067\u3059\u304c\u3001\u5f71\u97ff\u7bc4\u56f2\u3092\u6700\u5c0f\u5316\u3059\u308b\u305f\u3081\u306b\u30ed\u30fc\u30ab\u30eb\u306ebind\u3092\u5229\u7528\u3057\u3066\u3044\u307e\u3059\u3002<\/li>\n<li><strong>relay1\u304a\u3088\u3073relay2<\/strong><br \/>\nmail\u30db\u30b9\u30c8\u304b\u3089\u30ea\u30ec\u30fc\u3055\u308c\u305f\u30e1\u30fc\u30eb\u3092\u305d\u308c\u305e\u308c\u8a2d\u5b9a\u306b\u5f93\u3063\u3066\u30ea\u30ec\u30fc\u3057\u307e\u3059\u3002\u4eca\u56de\u306frelay1\u3092SendGrid\u3078\u306e\u30ea\u30ec\u30fc\u7528\u3068\u3057\u3001relay2\u304b\u3089\u306f\u5b9b\u5148\u30b5\u30fc\u30d0\u306b\u76f4\u63a5\u9001\u4fe1\uff08\u65e2\u5b58\u306e\u30ea\u30ec\u30fc\u7d4c\u8def\u3092\u60f3\u5b9a\uff09\u3057\u307e\u3059\u3002<\/li>\n<\/ul>\n<p><img decoding=\"async\" src=\"https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2017\/07\/2.png\" alt=\"\u30b1\u30fc\u30b92\uff1aSendGrid\u3078\u79fb\u884c\u6642\u306e\u30a6\u30a9\u30fc\u30e0\u30a2\u30c3\u30d7\" width=\"100%\" class=\"alignnone size-full wp-image-8205\" srcset=\"https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2017\/07\/2.png 1280w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2017\/07\/2-300x186.png 300w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2017\/07\/2-768x476.png 768w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2017\/07\/2-1024x635.png 1024w, https:\/\/sendgrid.kke.co.jp\/blog\/wp\/wp-content\/uploads\/2017\/07\/2-592x366.png 592w\" sizes=\"(max-width: 1280px) 100vw, 1280px\" \/><\/p>\n<h5>2. mail\u30db\u30b9\u30c8\u4e0a\u306ePostfix\u8a2d\u5b9a<\/h5>\n<p>mail\u30db\u30b9\u30c8\u306ePostfix\u3067\u30ea\u30ec\u30fc\u5148\u306e\u30db\u30b9\u30c8\u3092\u8a2d\u5b9a\uff08<strong>\/etc\/postfix\/main.cf<\/strong>\u30d5\u30a1\u30a4\u30eb\uff09\u3057\u307e\u3059\u3002\u3053\u3053\u3067\u8a2d\u5b9a\u3059\u308b\u30ea\u30ec\u30fc\u5148\u300crelay.example.local\u300d\u306f\u3053\u306e\u5f8c\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nrelayhost = relay.example.local\r\n<\/pre>\n<p>\u6b21\u306bmail\u30db\u30b9\u30c8\u306ePostfix\u304c\u30ed\u30fc\u30ab\u30eb\u306ebind\u3092\u53c2\u7167\u3057\u3066\u540d\u524d\u89e3\u6c7a\u3059\u308b\u3088\u3046\u30ec\u30be\u30eb\u30d0\u8a2d\u5b9a\uff08<strong>\/var\/spool\/postfix\/etc\/resolv.conf<\/strong>\uff09\u3092\u6b21\u306e\u3088\u3046\u306b\u5909\u66f4\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nnameserver 127.0.0.1\r\ndomain example.local\r\n<\/pre>\n<p>Postfix\u3092\u518d\u8d77\u52d5\u3057\u3066\u8a2d\u5b9a\u3092\u53cd\u6620\u3055\u305b\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ sudo postfix stop\r\n$ sudo postfix start\r\n<\/pre>\n<h5>3. mail\u4e0a\u306ebind\u8a2d\u5b9a<\/h5>\n<p>mail\u30db\u30b9\u30c8\u306ebind\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002<strong>\/etc\/bind\/named.conf.default-zones<\/strong>\u30d5\u30a1\u30a4\u30eb\u306b<strong>example.local<\/strong>\u3068\u3044\u3046\u540d\u524d\u3067\u30be\u30fc\u30f3\u3092\u4f5c\u6210\u3057\u307e\u3059\u3002\u30be\u30fc\u30f3\u540d\u306f\u30ed\u30fc\u30ab\u30eb\u306b\u9589\u3058\u305f\u74b0\u5883\u3067\u5229\u7528\u3059\u308b\u3082\u306e\u306a\u306e\u3067\u4f55\u3067\u3082\u69cb\u3044\u307e\u305b\u3093\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nzone &quot;example.local&quot; {\r\n        type master;\r\n        file &quot;\/etc\/bind\/example.local.zone&quot;;\r\n};\r\n<\/pre>\n<p>example.local\u30be\u30fc\u30f3\u5185\u306e\u30ec\u30b3\u30fc\u30c9\u306f<strong>\/etc\/bind\/example.local.zone<\/strong>\u30d5\u30a1\u30a4\u30eb\u306b\u8a18\u8ff0\u3057\u307e\u3059\u3002<br \/>\n\u4f8b\u3048\u3070\u3001MX\u30ec\u30b3\u30fc\u30c95\u3064\u306e\u3046\u3061\u30011\u3064\u3060\u3051\u3092relay1\u30db\u30b9\u30c8\u306b\u3001\u6b8b\u308a\u3092relay2\u3068\u306a\u308b\u3088\u3046\u8a2d\u5b9a\u3057\u305f\u4f8b\u306f\u4ee5\u4e0b\u306e\u901a\u308a\u3067\u3059\u3002\u3053\u308c\u3067\u7406\u8ad6\u4e0a\u3001\u5168\u4f53\u306e20%\u306e\u30e1\u30fc\u30eb\u304crelay1\u30db\u30b9\u30c8\u3092\u7d4c\u7531\u3057\u3066SendGrid\u306b\u30ea\u30ec\u30fc\u3055\u308c\u308b\u306f\u305a\u3067\u3059\u3002\u30a6\u30a9\u30fc\u30e0\u30a2\u30c3\u30d7\u30b9\u30b1\u30b8\u30e5\u30fc\u30eb\u306b\u5408\u308f\u305b\u3066SendGrid\u7d4c\u7531\u3067\u30ea\u30ec\u30fc\u3059\u308bMX\u30ec\u30b3\u30fc\u30c9\u306e\u5272\u5408\u3092\u5897\u3084\u3057\u3066\u3044\u304f\u3053\u3068\u3067\u5f90\u3005\u306b\u305d\u306e\u5272\u5408\u3092\u5897\u3084\u3057\u3066\u3044\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$TTL    86400\r\n@       IN      SOA     example.local. root.example.local. (\r\n                                2017063002      ; Serial\r\n                                3600            ; Refresh\r\n                                900             ; Retry\r\n                                3600000         ; Expire\r\n                                86400 )         ; Minimum\r\n        IN      NS      ns.example.local.\r\nns      IN      A       10.1.0.4\r\nrelay   IN      MX      10      relay10.example.local.\r\nrelay   IN      MX      10      relay20.example.local.\r\nrelay   IN      MX      10      relay21.example.local.\r\nrelay   IN      MX      10      relay22.example.local.\r\nrelay   IN      MX      10      relay23.example.local.\r\nrelay10 IN      A       10.1.0.5\r\nrelay20 IN      A       10.1.0.6\r\nrelay21 IN      A       10.1.0.6\r\nrelay22 IN      A       10.1.0.6\r\nrelay23 IN      A       10.1.0.6\r\n<\/pre>\n<p>bind\u306e\u8a2d\u5b9a\u304c\u5b8c\u4e86\u3057\u305f\u306e\u3067\u8d77\u52d5\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ sudo systemctl enable bind9\r\n$ sudo systemctl start bind9\r\n<\/pre>\n<h5>4. relay1\u304a\u3088\u3073relay2\u4e0a\u306ePostfix\u8a2d\u5b9a<\/h5>\n<p>relay1\u30db\u30b9\u30c8\u306ePostfix\u306f<a href=\"https:\/\/sendgrid.kke.co.jp\/docs\/Integrate\/Mail_Servers\/postfix.html\" target=\"_blank\">SendGrid\u306b\u30ea\u30ec\u30fc\u3059\u308b\u3088\u3046\u8a2d\u5b9a<\/a>\uff08<strong>\/etc\/postfix\/main.cf<\/strong>\u30d5\u30a1\u30a4\u30eb\uff09\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n# \u30db\u30b9\u30c8\u540d\u3092\u6307\u5b9a\r\nmyhostname = relay1.example.local\r\n\r\n# mynetworks\u306b\u73fe\u5728\u306e\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u30a2\u30c9\u30ec\u30b9\u3092\u8ffd\u52a0\r\nmynetworks = 127.0.0.0\/8 &#x5B;::ffff:127.0.0.0]\/104 &#x5B;::1]\/128 10.1.0.0\/24\r\n\r\n# mynetworks\u304b\u3089\u306e\u30a2\u30af\u30bb\u30b9\u3092\u8a31\u53ef\r\nsmtpd_client_restrictions = permit_mynetworks, reject\r\n\r\n# SendGrid\u5411\u3051\u306e\u30ea\u30ec\u30fc\u8a2d\u5b9a\r\nsmtp_sasl_password_maps = static:apikey:SendGrid\u306eAPI\u30ad\u30fc\r\nsmtp_sasl_auth_enable = yes\r\nsmtp_sasl_security_options = noanonymous\r\nsmtp_tls_security_level = encrypt\r\nrelayhost = &#x5B;smtp.sendgrid.net]:587\r\n<\/pre>\n<p>\u4e00\u65b9\u3001relay2\u30db\u30b9\u30c8\u306ePostfix\u306f\u30ea\u30ec\u30fc\u305b\u305a\u306b\u76f4\u63a5\u5b9b\u5148\u306b\u914d\u4fe1\u3059\u308b\u3088\u3046\u8a2d\u5b9a\uff08<strong>\/etc\/postfix\/main.cf<\/strong>\u30d5\u30a1\u30a4\u30eb\uff09\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n# \u30db\u30b9\u30c8\u540d\u3092\u6307\u5b9a\r\nmyhostname = relay2.example.local\r\n\r\n# mynetworks\u306b\u73fe\u5728\u306e\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u30a2\u30c9\u30ec\u30b9\u3092\u8ffd\u52a0\r\nmynetworks = 127.0.0.0\/8 &#x5B;::ffff:127.0.0.0]\/104 &#x5B;::1]\/128 10.1.0.0\/24\r\n\r\n# mynetworks\u304b\u3089\u306e\u30a2\u30af\u30bb\u30b9\u3092\u8a31\u53ef\r\nsmtpd_client_restrictions = permit_mynetworks, reject\r\n<\/pre>\n<p>\u305d\u308c\u305e\u308cPostfix\u3092\u518d\u8d77\u52d5\u3057\u3066\u8a2d\u5b9a\u3092\u53cd\u6620\u3055\u305b\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ sudo postfix stop\r\n$ sudo postfix start\r\n<\/pre>\n<h5>5. \u52d5\u4f5c\u78ba\u8a8d<\/h5>\n<p>\u52d5\u4f5c\u78ba\u8a8d\u3092\u884c\u3046\u305f\u3081\u3001mail\u30db\u30b9\u30c8\u4e0a\u304b\u3089\u30e1\u30fc\u30eb\u3092\u9001\u4fe1\u3057\u307e\u3059\u3002\u30e1\u30fc\u30eb\u3092\u7e70\u308a\u8fd4\u3057\u9001\u4fe1\u3059\u308b\u3068\u3001\u30ea\u30ec\u30fc\u5148\u304c\u5206\u6563\u3055\u308c\u308b\u306f\u305a\u3067\u3059\u3002\u30ea\u30ec\u30fc\u7d4c\u8def\u306f\u5b9f\u969b\u306b\u5c4a\u3044\u305f\u30e1\u30fc\u30eb\u306e\u30d8\u30c3\u30c0\u3067\u78ba\u8a8d\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$ sudo apt-get install mailutils\r\n$ echo &quot;Hello kke&quot; | mail -s &quot;Hello kke&quot; -aFrom:from@example.com to@kke.co.jp\r\n$ echo &quot;Hello kke&quot; | mail -s &quot;Hello kke&quot; -aFrom:from@example.com to@kke.co.jp\r\n$ echo &quot;Hello kke&quot; | mail -s &quot;Hello kke&quot; -aFrom:from@example.com to@kke.co.jp\r\n\uff1a\r\n<\/pre>\n<h3>\u30b1\u30fc\u30b93\uff1aSendGrid\u4ee5\u5916\u306b\u8907\u6570\u306e\u30e1\u30fc\u30eb\u914d\u4fe1\u30b5\u30fc\u30d3\u30b9\u3092\u5229\u7528\u3057\u53ef\u7528\u6027\u3092\u5411\u4e0a\u3059\u308b<\/h3>\n<p>\u57fa\u672c\u7684\u306a\u69cb\u6210\u306f\u30b1\u30fc\u30b92\u3068\u540c\u3058\u3067\u3059\u304c\u3001relay1\u3068relay2\u306eMX\u30ec\u30b3\u30fc\u30c9\u306e\u512a\u5148\u5ea6\u306b\u5dee\u3092\u3064\u3051\u308b\u3053\u3068\u3067\u512a\u5148\u5ea6\u306e\u9ad8\u3044\u30b5\u30fc\u30d0\u306b\u512a\u5148\u7684\u306b\u30ea\u30ec\u30fc\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u3053\u3046\u3059\u308b\u3068\u3001\u512a\u5148\u5ea6\u306e\u9ad8\u3044\u30b5\u30fc\u30d0\u304c\u5229\u7528\u3067\u304d\u306a\u3044\u5834\u5408\u306f\u3001\u81ea\u52d5\u7684\u306b\u6b21\u306b\u512a\u5148\u5ea6\u306e\u9ad8\u3044\u30b5\u30fc\u30d0\u306b\u30ea\u30ec\u30fc\u3057\u307e\u3059\u3002\u3053\u306e\u6319\u52d5\u3092\u5229\u7528\u3057\u3066\u30e1\u30a4\u30f3\u306e\u30e1\u30fc\u30eb\u914d\u4fe1\u30b5\u30fc\u30d3\u30b9\u304c\u5229\u7528\u3067\u304d\u306a\u3044\u5834\u5408\u306b\u81ea\u52d5\u7684\u306b\u30d5\u30a9\u30fc\u30eb\u30d0\u30c3\u30af\u3057\u3066\u30b5\u30d6\u306e\u914d\u4fe1\u30b5\u30fc\u30d3\u30b9\u306b\u5207\u308a\u66ff\u3048\u308b\u3053\u3068\u304c\u53ef\u80fd\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><strong>\/etc\/bind\/example.local.zone<\/strong>\u30d5\u30a1\u30a4\u30eb\u3092\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8a2d\u5b9a\u3059\u308b\u3068\u3001\u901a\u5e38\u306frelay10.example.local\u306b\u30ea\u30ec\u30fc\u3055\u308c\u307e\u3059\u304c\u3001relay10.example.local\u306b\u554f\u984c\u304c\u3042\u308b\u5834\u5408\u306frelay20.example.local\u306b\u81ea\u52d5\u7684\u306b\u30ea\u30ec\u30fc\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n$TTL    86400\r\n@       IN      SOA     example.local. root.example.local. (\r\n                                2017063003      ; Serial\r\n                                3600            ; Refresh\r\n                                900             ; Retry\r\n                                3600000         ; Expire\r\n                                86400 )         ; Minimum\r\n        IN      NS      ns.example.local.\r\nns      IN      A       10.1.0.4\r\nrelay   IN      MX      10      relay10.example.local.\r\nrelay   IN      MX      20      relay20.example.local.\r\nrelay10 IN      A       10.1.0.5\r\nrelay20 IN      A       10.1.0.6\r\n<\/pre>\n<h3>\u3055\u3044\u3054\u306b<\/h3>\n<p>\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u304b\u3089\u7c21\u5358\u306b\u30e1\u30fc\u30eb\u9001\u4fe1\u3067\u304d\u308b\u306e\u304c\u7279\u5fb4\u306eSendGrid\u3067\u3059\u304c\u3001\u5143\u3005SMTP\u30ea\u30ec\u30fc\u30b5\u30fc\u30d3\u30b9\u3067\u3059\u306e\u3067\u3001\u8907\u96d1\u306a\u30ea\u30ec\u30fc\u69cb\u6210\u306e\u4e2d\u306b\u3082\u67d4\u8edf\u306b\u7d44\u307f\u8fbc\u3080\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002SendGrid\u3092\u7d4c\u7531\u3059\u308b\u3053\u3068\u3067\u3001\u9001\u4fe1\u30c9\u30e1\u30a4\u30f3\u8a8d\u8a3c\u8a2d\u5b9a\uff08SPF\u3084DKIM\uff09\u3084\u30d0\u30a6\u30f3\u30b9\u7ba1\u7406\u3001\u30c8\u30e9\u30c3\u30ad\u30f3\u30b0\u30c7\u30fc\u30bf\u306e\u4e00\u5143\u5316\u306a\u3069\u3001\u300c\u9001\u4fe1\u7528\u30e1\u30fc\u30eb\u30b2\u30fc\u30c8\u30a6\u30a7\u30a4\u300d\u7684\u306a\u4f7f\u3044\u65b9\u3082\u3067\u304d\u307e\u3059\u306e\u3067<a href=\"https:\/\/sendgrid.kke.co.jp\/app?p=signup.index\" target=\"_blank\">\u305c\u3072\u304a\u8a66\u3057\u304f\u3060\u3055\u3044<\/a>\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u306f\u3058\u3081\u306b \u4eca\u56de\u306f\u3001SendGrid\u3092SMTP\u306e\u30ea\u30ec\u30fc\u30b5\u30fc\u30d0\u3068\u3057\u3066\u5229\u7528\u3059\u308b\u969b\u306e\u30c6\u30af\u30cb\u30c3\u30af\u3092\u3044\u304f\u3064\u304b\u3054\u7d39\u4ecb\u3057\u307e\u3059\u3002\u6b21\u306e\u3088\u3046\u306a\u8ab2\u984c\u89e3\u6c7a\u306e\u30d2\u30f3\u30c8\u306b\u306a\u308c\u3070\u5e78\u3044\u3067\u3059\u3002 \u30b1\u30fc\u30b91\uff1a\u5b9b\u5148\u30c9\u30e1\u30a4\u30f3\u6bce\u306e\u30ea\u30ec\u30fc\u5236\u5fa1 \u4f8b\u3048\u3070\u3001\u7279\u5b9a\u30c9\u30e1\u30a4\u30f3\u5b9b\u306e\u30e1 <a class=\"read-more\" href=\"https:\/\/sendgrid.kke.co.jp\/blog\/?p=8192\">&#8230;\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":4,"featured_media":14560,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[11],"tags":[],"class_list":["post-8192","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technical"],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/8192","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8192"}],"version-history":[{"count":12,"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/8192\/revisions"}],"predecessor-version":[{"id":8208,"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/posts\/8192\/revisions\/8208"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=\/wp\/v2\/media\/14560"}],"wp:attachment":[{"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8192"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8192"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sendgrid.kke.co.jp\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8192"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}