ä»åã¯æè¡ãã¿ã§ãã
Â
çµç·¯Â
PHPã使ã£ã¦ãã¡ã¼ã«ãéä¿¡ãããã£ãã®ã§ãããPHPã§å®è£ ããã¦ããã¡ã¼ã©ã¼ï¼ã使ãã¨ããè¿·æã¡ã¼ã«ã«å ¥ãããã¦ãã¾ãã¾ãã
Â
ããã§èª¿ã¹ãã¨ãããGmailã®SMTPçµç±ã§éãã¨å¤§ä¸å¤«ã£ã½ãã£ãã®ã§ãæ°è¦ã§Gmailã¢ã«ã¦ã³ããä½æãããã®ã¢ã«ã¦ã³ããçµç±ãã¦éä¿¡ãããã¨ã«ãã¾ããã
Â
å¤é¨ã®SMTPã使ã£ã¦éããã©ã¤ãã©ãªã調ã¹ã
ä¸è¨ã®äºã¤ãè¦ã¤ããã¾ããã
Â
ã»qdmail
ã»PHPMailer
Â
åãã¯qdmailã使ããã¨æãã¾ããããéååã«æ´æ°ãæ¢ã¾ã£ã¦ããã®ã¨ãPHP5.5ã ã¨è¦åãåºãã¨ããæ å ±ããã£ãä¸ã«ã軽ã試ããçµæããããã¨ã©ã¼ãåºãï¼è©³ç´°ã¯ã¡ã¢ãå¿ãã¾ããï¼ã®ã§ãPHPMailerã使ããã¨ã«ãã¾ããã
Â
åèã«ããæ å ±
ã»PHPMailer 㧠GMail éä¿¡ â Airwhite Memo
Â
ç´é¢ããåé¡
ä¸è¨ãµã¤ãã®ã½ã¼ã¹ãåèã«åããã¦ã¿ãã®ã§ãããSMTP connect() failed.ã¨è¡¨ç¤ºãããéä¿¡ã§ãã¾ããã§ããã
Â
ä¸è¨ã®ãµã¤ããè¦æ¯ã¹ã¦ããããã¨ãããã®ã§ãã
ã»ãã¼ãã465ã ã£ãã587ã ã£ãã
ã»SSLã ã£ããTLSã ã£ãã
ãã®çµã¿åãããééã£ã¦ããã®ãåå ãªã®ããªã¨æ¨æ¸¬ããã®ã§ãããéã£ãããã§ãã
ã¡ãªã¿ã«Â
å ¬å¼ãµã¤ãã«ã¯
ãã¼ã 465ï¼SSLï¼ã¨ãã¼ã 587ï¼TLSï¼
ã¨æ¸ãã¦ããã®ã§ã
ã»SSLãé¸æããå ´åã¯ãã¼ã465ã
ã»TLSãé¸æããå ´åã¯587ã
é¸æããã¹ããªããã§ãã
Â
解決æ¹æ³
Gmailã«ã¯ã»ãã¥ãªãã£ã®é¢ä¿ä¸ãå¤é¨ã®ãµã¼ãã¹ã使ããªãããã«ãããããªå¯¾çãããã¦ããããã§ãã
Â
ãã¡ãã«ã¢ã¯ã»ã¹ãã¦å®å ¨æ§ã®ä½ãã¢ããªã®ã¢ã¯ã»ã¹ããªã³ã«ãããé¸æãã¦ãã ããã
https://www.google.com/settings/security/lesssecureapps
Â
åæ ãããã¾ã§æéããããå¯è½æ§ãï¼
ããã¯æ¨æ¸¬ãªã®ã§ããããã®è¨å®ãåæ ãããã¾ã§æéããããããããã¾ããã
ã¨ããã®ããåããªãã£ãã½ã¼ã¹ãä¸è¨ã®è¨å®å¤æ´ãã¦ããã¯ç¸å¤ãããåããªãã£ãã®ã«ãåæ¥ã»ã©æ¾ç½®ãã¦å度確èªããã¨åãããã«ãªã£ã¦ããããã§ãã
Â
ãã®è¨å®ãåæ ã¾ã§æéãããããã®ãªã®ããããã¨ãæ°è¦ã§ä½æããã¢ã«ã¦ã³ãã ã£ããããªã®ããåå ã¯ãããã¾ãããâ¦æ å ±ã¨ãã¦è¨è¼ãã¦ããã¾ãã
Â
æå¾ã«åä½ããã½ã¼ã¹ãè²¼ã£ã¦ããã¾ã
æºå
ãã®ä¸ã¤ãåä¸ãã©ã«ãã«å ¥ãã¦ããã¾ãã
ã»PHPMailerAutoload.php
ã»class.smtp.php
ã»class.phpmailer.php
Â