{"id":7345,"date":"2016-09-14T13:10:19","date_gmt":"2016-09-14T04:10:19","guid":{"rendered":"https:\/\/www.ka-net.org\/blog\/?p=7345"},"modified":"2016-09-14T13:15:32","modified_gmt":"2016-09-14T04:15:32","slug":"phpmailer%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6office-365%e3%81%aesmtp%e7%b5%8c%e7%94%b1%e3%81%a7%e3%83%a1%e3%83%bc%e3%83%ab%e9%80%81%e4%bf%a1%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=7345","title":{"rendered":"PHPMailer\u3092\u4f7f\u3063\u3066Office 365\u306eSMTP\u7d4c\u7531\u3067\u30e1\u30fc\u30eb\u9001\u4fe1\u3059\u308b\u65b9\u6cd5"},"content":{"rendered":"<p>Microsoft Community\u306b<a href=\"http:\/\/answers.microsoft.com\/thread\/38beb7e7-27af-4495-9cc5-32a63e9f323e\" title=\"PHPmail \u3067\u3001outlook.office365.com \u7d4c\u7531\u3067\u30e1\u30fc\u30eb\u3092\u9001\u4fe1\u3057\u305f\u3044\u3002 - \u30de\u30a4\u30af\u30ed\u30bd\u30d5\u30c8 \u30b3\u30df\u30e5\u30cb\u30c6\u30a3\" target=\"_blank\">PHP\u304b\u3089Office 365\u7d4c\u7531\u3067\u30e1\u30fc\u30eb\u9001\u4fe1\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u306e\u8cea\u554f<\/a>\u304c\u3042\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u3053\u308c\u307e\u3067PHP\u304b\u3089\u30e1\u30fc\u30eb\u9001\u4fe1\u3057\u305f\u3053\u3068\u306f\u3042\u308a\u307e\u3057\u305f\u304c\u3001Office 365\u306eSMTP\u30b5\u30fc\u30d0\u30fc\u3092\u7d4c\u7531\u3057\u3066\u9001\u4fe1\u3057\u305f\u3053\u3068\u306f\u7121\u304b\u3063\u305f\u306e\u3067\u3001\u826f\u3044\u6a5f\u4f1a\u306a\u306e\u3067\u79c1\u3082\u8a66\u3057\u3066\u307f\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f<\/p>\n<h4 class=\"style4a\">PHPMailer\u306e\u4f7f\u7528<\/h4>\n<p>\u30e1\u30fc\u30eb\u9001\u4fe1\u306b\u306f\u5b9a\u756a\u306e\u300c<a href=\"https:\/\/github.com\/PHPMailer\/PHPMailer\" title=\"GitHub - PHPMailer\/PHPMailer: The classic email sending library for PHP\" target=\"_blank\">PHPMailer<\/a>\u300d\u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<p>\u4f7f\u3044\u65b9\u306f\u7c21\u5358\u3067\u3001<a href=\"https:\/\/github.com\/PHPMailer\/PHPMailer\" title=\"GitHub - PHPMailer\/PHPMailer: The classic email sending library for PHP\" target=\"_blank\">GitHub<\/a>\u304b\u3089zip\u30d5\u30a1\u30a4\u30eb\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u30fb\u89e3\u51cd\u3057\u3066\u3001\u300c<span style=\"color: #ff0000; font-weight: bold;\">PHPMailerAutoload.php<\/span>\u300d\u30d5\u30a1\u30a4\u30eb\u3092\u8aad\u307f\u8fbc\u3080\u3060\u3051\u3067\u3059\u3002<\/p>\n<h4 class=\"style4a\">\u30b5\u30fc\u30d0\u30fc\u60c5\u5831<\/h4>\n<p>\u8a8d\u8a3c\u6642\u306b\u5fc5\u8981\u3068\u306a\u308b\u30b5\u30fc\u30d0\u30fc\u60c5\u5831\u306f\u4e0b\u8a18\u30b5\u30dd\u30fc\u30c8\u30da\u30fc\u30b8\u306b\u8a18\u8f09\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><strong>\u30fb\u4e00\u822c\u6cd5\u4eba\u5411\u3051 Office 365 \u7528\u306e Outlook POP \u304a\u3088\u3073 Outlook IMAP \u306e\u8a2d\u5b9a &#8211; Office \u306e\u30b5\u30dd\u30fc\u30c8<\/strong><br \/>\n<a href=\"https:\/\/support.office.com\/ja-jp\/article\/7fc677eb-2491-4cbc-8153-8e7113525f6c\" title=\"\u4e00\u822c\u6cd5\u4eba\u5411\u3051 Office 365 \u7528\u306e Outlook POP \u304a\u3088\u3073 Outlook IMAP \u306e\u8a2d\u5b9a - Office \u306e\u30b5\u30dd\u30fc\u30c8\" target=\"_blank\">https:\/\/support.office.com\/ja-jp\/article\/7fc677eb-2491-4cbc-8153-8e7113525f6c<\/a><\/p>\n<p>\u30e1\u30fc\u30eb\u9001\u4fe1\u3092\u884c\u3046\u306e\u3067\u3001\u4f7f\u3046\u306e\u306fSMTP\u30b5\u30fc\u30d0\u30fc\u3060\u3051\u3067\u3059\u306d\u3002<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">smtp.office365.com : 587\u30dd\u30fc\u30c8(TLS)<\/pre>\n<h4 class=\"style4a\">PHPMailer\u3092\u4f7f\u3063\u3066Office 365\u306eSMTP\u7d4c\u7531\u3067\u30e1\u30fc\u30eb\u9001\u4fe1\u3059\u308b\u30b3\u30fc\u30c9<\/h4>\n<p>\u3055\u3063\u305d\u304f\u66f8\u3044\u305f\u306e\u304c\u4e0b\u8a18\u30b3\u30fc\u30c9\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p><span style=\"color: #ff0000; font-weight: bold;\">\u203b \u30e6\u30fc\u30b6\u30fc\u540d\u3084\u30d1\u30b9\u30ef\u30fc\u30c9\u3001\u672c\u6587\u3084\u5b9b\u5148\u306a\u3069\u3001\u5fc5\u8981\u306b\u5fdc\u3058\u3066\u5909\u66f4\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/span><\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">&lt;?php\r\n  error_reporting(E_ALL &amp; ~E_NOTICE);\r\n  require_once &quot;.\/PHPMailer\/PHPMailerAutoload.php&quot;; \/\/\u30e9\u30a4\u30d6\u30e9\u30ea\u30fc\u8aad\u8fbc\r\n  \r\n  \/\/\u8a8d\u8a3c\u60c5\u5831\r\n  $host = &quot;smtp.office365.com&quot;;\r\n  $smtp_user = &quot;user@***.onmicrosoft.com&quot;;\r\n  $smtp_password = &quot;*****&quot;;\r\n  $from = &quot;user@***.onmicrosoft.com&quot;;\r\n  $fromname = &quot;\u30c6\u30b9\u30c8\u5dee\u51fa\u4eba&quot;;\r\n  \r\n  \/\/\u5b9b\u5148\u30fb\u4ef6\u540d\u30fb\u672c\u6587\r\n  $to = &quot;user@***.onmicrosoft.com&quot;;\r\n  $subject = &quot;\u30c6\u30b9\u30c8\u30e1\u30fc\u30eb&quot;;\r\n  $body = &quot;\u30e1\u30fc\u30eb\u672c\u6587\\n\u3042\u3044\u3046\u3048\u304a\\nABCDEFG&quot;;\r\n  \r\n  $mail = new PHPMailer();\r\n  $mail-&gt;IsSMTP();\r\n  $mail-&gt;SMTPAuth = true;\r\n  $mail-&gt;SMTPDebug = 2;\r\n  $mail-&gt;CharSet = &quot;utf-8&quot;;\r\n  $mail-&gt;SMTPSecure = &quot;tls&quot;;\r\n  $mail-&gt;Host = $host;\r\n  $mail-&gt;Port = 587;\r\n  $mail-&gt;IsHTML(false);\r\n  $mail-&gt;Username = $smtp_user;\r\n  $mail-&gt;Password = $smtp_password; \r\n  $mail-&gt;SetFrom($smtp_user);\r\n  $mail-&gt;From = $fromaddress;\r\n  $mail-&gt;FromName = $fromname;\r\n  $mail-&gt;Subject = $subject;\r\n  $mail-&gt;Body = $body;\r\n  $mail-&gt;AddAddress($to);\r\n  if(!$mail-&gt;Send()){\r\n    echo &quot;Error : &quot; . $mailer-&gt;ErrorInfo;\r\n  }<\/pre>\n<h4 class=\"style4a\">\u9001\u4fe1\u7d50\u679c<\/h4>\n<p>\u4e0a\u8a18\u30b3\u30fc\u30c9\u3092\u5b9f\u884c\u3059\u308b\u3068\u3001\u7279\u306b\u554f\u984c\u306a\u304f\u30e1\u30fc\u30eb\u304c\u9001\u4fe1\u3055\u308c\u3001\u4e0b\u56f3\u306e\u3088\u3046\u306b\u7121\u4e8b\u306b\u53d7\u4fe1\u3067\u304d\u308b\u3053\u3068\u3082\u78ba\u8a8d\u3057\u307e\u3057\u305f\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/PHPMailer_Office365_01.jpg\" alt=\"PHPMailer_Office365_01\" width=\"949\" height=\"288\" class=\"alignnone size-full wp-image-7346\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/PHPMailer_Office365_01.jpg 949w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/PHPMailer_Office365_01-300x91.jpg 300w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/PHPMailer_Office365_01-768x233.jpg 768w\" sizes=\"auto, (max-width: 949px) 100vw, 949px\" \/><\/p>\n<p>\u3053\u3093\u306a\u77ed\u3044\u30b3\u30fc\u30c9\u3067\u5916\u90e8\u306e\u30e1\u30fc\u30eb\u30b5\u30fc\u30d0\u30fc\u304b\u3089\u30e1\u30fc\u30eb\u9001\u4fe1\u3067\u304d\u308b\u300c<span style=\"color: #ff0000; font-weight: bold;\">PHPMailer<\/span>\u300d\u306f\u30db\u30f3\u30c8\u4fbf\u5229\u3060\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<div id=\"single_banner_area2\" class=\"clearfix one_banner\">\n<div class=\"single_banner single_banner_left\">\n<script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\r\n<!-- \u8a18\u4e8b\u4e2d(\u30c7\u30a3\u30b9\u30d7\u30ec\u30a4\u5e83\u544a\u30e6\u30cb\u30c3\u30c8) -->\r\n<ins class=\"adsbygoogle\"\r\n     style=\"display:block\"\r\n     data-ad-client=\"ca-pub-7306936664602087\"\r\n     data-ad-slot=\"5429724765\"\r\n     data-ad-format=\"auto\"\r\n     data-full-width-responsive=\"true\"><\/ins>\r\n<script>\r\n     (adsbygoogle = window.adsbygoogle || []).push({});\r\n<\/script>\n<\/div>\n<div class=\"single_banner single_banner_right\">\n<a href=\"\" target=\"_blank\"><img decoding=\"async\" src=\"\" alt=\"\" title=\"\" \/><\/a>\n<\/div>\n<\/div>\n\n","protected":false},"excerpt":{"rendered":"Microsoft Community\u306bPHP\u304b\u3089Office 365\u7d4c\u7531\u3067\u30e1\u30fc\u30eb\u9001\u4fe1\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u306e\u8cea\u554f\u304c\u3042\u308a\u307e\u3057\u305f\u3002 \u3053\u308c\u307e\u3067PHP\u304b\u3089\u30e1\u30fc\u30eb\u9001\u4fe1\u3057\u305f\u3053\u3068\u306f\u3042\u308a\u307e\u3057\u305f\u304c\u3001Office 365\u306eSMTP\u30b5\u30fc\u30d0\u30fc\u3092\u7d4c\u7531 [&hellip;]","protected":false},"author":1,"featured_media":7118,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"PHPMailer\u306f\u304a\u624b\u8efd\u3067\u4fbf\u5229\u3060\u3068\u601d\u3044\u307e\u3059\u3002  [PHPMailer\u3092\u4f7f\u3063\u3066Office 365\u306eSMTP\u7d4c\u7531\u3067\u30e1\u30fc\u30eb\u9001\u4fe1\u3059\u308b\u65b9\u6cd5]","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4,112],"tags":[],"class_list":["post-7345","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-office","category-office365"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-Office365.png","jetpack_shortlink":"https:\/\/wp.me\/p4UZZr-1Ut","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/7345","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7345"}],"version-history":[{"count":3,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/7345\/revisions"}],"predecessor-version":[{"id":7349,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/7345\/revisions\/7349"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/media\/7118"}],"wp:attachment":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7345"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7345"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7345"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}