{"id":220013,"date":"2023-01-26T12:57:00","date_gmt":"2023-01-26T09:57:00","guid":{"rendered":"https:\/\/wordpress.mediadoma.com\/?p=220013"},"modified":"2023-02-04T17:24:33","modified_gmt":"2023-02-04T14:24:33","slug":"kak-reshit-smtp-ne-udalos-autentificirovatsja-s-pomoshhju-gmail-phpmailer","status":"publish","type":"post","link":"https:\/\/wordpress.mediadoma.com\/ru\/kak-reshit-smtp-ne-udalos-autentificirovatsja-s-pomoshhju-gmail-phpmailer\/","title":{"rendered":"\u041a\u0430\u043a \u0440\u0435\u0448\u0438\u0442\u044c SMTP: \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Gmail + PHPMailer?"},"content":{"rendered":"<p>\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u043f\u043e\u0447\u0442\u044b \u0447\u0435\u0440\u0435\u0437 PHPMailer \u0447\u0430\u0441\u0442\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 PHP, \u0435\u0441\u043b\u0438 \u0432\u044b \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u0442\u0435\u0441\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f \u043f\u043e \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u0435, \u043a\u043e\u0433\u0434\u0430 \u0432 \u0432\u0430\u0448\u0435\u043c \u0431\u043b\u043e\u0433\u0435 WordPress \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043d\u043e\u0432\u044b\u0435 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438, \u0438\u043b\u0438 \u043a\u043e\u0433\u0434\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0436\u0435\u043d \u0438\u0437-\u0437\u0430 \u0432\u044b\u0441\u043e\u043a\u043e\u0439 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0426\u041f (\u0447\u0435\u0440\u0435\u0437 \u0432\u0440\u0435\u043c\u044f \u0431\u0435\u0437\u043e\u0442\u043a\u0430\u0437\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b, \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0449\u0435\u0435 \u0441\u0440\u0435\u0434\u043d\u044e\u044e \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0443 \u0437\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 1, 5 \u0438 15 \u043c\u0438\u043d\u0443\u0442).<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 Gmail, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, Google GMail \u0441\u043e\u043e\u0431\u0449\u0438\u0442 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435: \u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0432\u044b \u0432\u0432\u0435\u043b\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u043f\u0430\u0440\u043e\u043b\u044c \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0439 \u0443\u0447\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 Gmail.<\/p>\n<p>\u0420\u0430\u0437\u043c\u0435\u0449\u0430\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u044c \u0441\u0432\u043e\u0435\u0439 \u0443\u0447\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u043f\u0440\u044f\u043c\u043e \u0433\u0434\u0435-\u0442\u043e \u0432 \u0432\u0430\u0448\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u0435 \u2014 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u0430\u044f \u0438\u0434\u0435\u044f, \u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0435\u0448\u0438\u0442\u044c \u044d\u0442\u0443 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0438 \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0443\u0442\u0435\u0447\u043a\u0438 \u0432\u0430\u0448\u0435\u0433\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e \u043f\u0430\u0440\u043e\u043b\u044f \u0443\u0447\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u043f\u0438\u0441\u0438 \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u044b \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u043c\u0435\u043d\u0435\u0435 \u0437\u0430\u0449\u0438\u0449\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043d\u0435 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0437\u0434\u0435\u0441\u044c \u044d\u0442\u043e \u043f\u0440\u043e\u0441\u0442\u043e PHP-\u0441\u043a\u0440\u0438\u043f\u0442.<\/p>\n<p>\u041f\u0430\u0440\u043e\u043b\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0435\u0433\u043e, \u0435\u0441\u043b\u0438 \u043e\u043d \u0441\u043a\u043e\u043c\u043f\u0440\u043e\u043c\u0435\u0442\u0438\u0440\u043e\u0432\u0430\u043d.<\/p>\n<p>\u0412\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u044c \u043f\u0430\u043d\u0435\u043b\u044c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 Google: <a href=\"https:\/\/myaccount.google.com\/security\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">https:\/\/myaccount.google.com\/security .<\/a><\/p>\n<p><a href=\"https:\/\/wordpress.mediadoma.com\/wp-content\/uploads\/2022\/01\/post-155998-61e57292d0be9.jpg\" data-rel=\"lightbox\"><img decoding=\"async\" class=\"SDStudio-light-box-enable SDStudio-editor-tools-md-imp\" src=\"https:\/\/wordpress.mediadoma.com\/wp-content\/uploads\/2022\/01\/post-155998-61e57292d0be9.jpg\" alt=\"\u041a\u0430\u043a \u0440\u0435\u0448\u0438\u0442\u044c SMTP: \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Gmail + PHPMailer?\"><\/a><\/p>\n<p>Google-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435-\u043f\u0430\u0440\u043e\u043b\u0438-\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c<\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043f\u0430\u0440\u043e\u043b\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f (\u0432\u044b\u0431\u0435\u0440\u0438\u0442\u0435 GMail \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u2014 \u0443\u043a\u0430\u0436\u0438\u0442\u0435 \u0438\u043c\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f) \u2014 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432 PHPMailer \u2014 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u0442\u0435\u0447\u043a\u0438 \u044d\u0442\u043e\u0433\u043e \u043f\u0430\u0440\u043e\u043b\u044f \u0432\u044b \u0432\u0441\u0435\u0433\u0434\u0430 \u043c\u043e\u0436\u0435\u0442\u0435 \u0443\u0434\u0430\u043b\u0438\u0442\u044c \u0435\u0433\u043e \u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0439.<\/p>\n<p><a href=\"https:\/\/wordpress.mediadoma.com\/wp-content\/uploads\/2022\/01\/post-155998-61e57294945ed.jpg\" data-rel=\"lightbox\"><img decoding=\"async\" class=\"SDStudio-light-box-enable SDStudio-editor-tools-md-imp\" src=\"https:\/\/wordpress.mediadoma.com\/wp-content\/uploads\/2022\/01\/post-155998-61e57294945ed.jpg\" alt=\"\u041a\u0430\u043a \u0440\u0435\u0448\u0438\u0442\u044c SMTP: \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Gmail + PHPMailer?\"><\/a><\/p>\n<p>google-app-\u043f\u0430\u0440\u043e\u043b\u0438<\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u044b \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430 <a href=\"https:\/\/helloacm.com\/send-emails-using-crontab-for-your-web-applications\/\" target=\"_blank\" rel=\"noopener nofollow\" class=\"external external_icon\">PHPMailer .<\/a><\/p>\n<pre><code>#!\/usr\/bin\/php\n&lt;?php\n\u00a0 use PHPMailerPHPMailerPHPMailer;\n\u00a0 use PHPMailerPHPMailerException;\n\u00a0 \n\u00a0 require 'PHPMailer\/src\/Exception.php';\n\u00a0 require 'PHPMailer\/src\/PHPMailer.php';\n\u00a0 require 'PHPMailer\/src\/SMTP.php';\n\u00a0\n\u00a0 $host = \"&lt;a class=\"vglnk\" target=\"_blank\" href=\"http:\/\/smtp.gmail.com\" rel=\"nofollow\"&gt;&lt;span&gt;smtp&lt;\/span&gt;&lt;span&gt;.&lt;\/span&gt;&lt;span&gt;gmail&lt;\/span&gt;&lt;span&gt;.&lt;\/span&gt;&lt;span&gt;com&lt;\/span&gt;&lt;\/a&gt;\";\n\u00a0 $port = 587;\n\u00a0 $secure = \"tls\";\n\/\/ \u00a0or the following configurations through SSL should work as well. \n\/\/ \u00a0$port = 465;\n\/\/ \u00a0$secure = \"ssl\";\n\u00a0 $username = \"Your GMAIL email\";\n\u00a0 $password = \"Your GMAIL App Password\";\n\u00a0 \n\u00a0 try {\n\u00a0 \u00a0 $mailer = new PHPMailer(true);\n\u00a0 \u00a0 $mailer-&gt;IsHTML(true);\n\u00a0 \u00a0 $mailer-&gt;IsSMTP();\n\u00a0 \u00a0 $mailer-&gt;From = $username;\n\u00a0 \u00a0 $mailer-&gt;FromName = $username;\n\u00a0 \u00a0 $mailer-&gt;ClearAllRecipients();\n\u00a0 \u00a0 $mailer-&gt;AddAddress(\"Recipent Email Address\", \"Recipent\");\n\u00a0 \u00a0 $mailer-&gt;Subject = \"Subject \";\n\u00a0 \u00a0 $mailer-&gt;Body = \"Hello, time is: \". date(\"Y-m-d h:i:s\");\n\u00a0 \u00a0 $mailer-&gt;SMTPAuth \u00a0 = true; \u00a0 \u00a0 \u00a0 \/\/ enable SMTP authentication\n\u00a0 \u00a0 $mailer-&gt;SMTPSecure = $secure; \u00a0 \u00a0\/\/ sets the prefix to the servier\n\u00a0 \u00a0 $mailer-&gt;Host \u00a0 \u00a0 \u00a0 = $host; \u00a0 \u00a0 \u00a0\/\/ sets GMAIL as the SMTP server\n\u00a0 \u00a0 $mailer-&gt;Port \u00a0 \u00a0 \u00a0 = $port; \u00a0 \u00a0 \u00a0\/\/ set the SMTP port for the GMAIL server\n\u00a0 \u00a0 $mailer-&gt;Username \u00a0 = $username; \u00a0\/\/ GMAIL username\n\u00a0 \u00a0 $mailer-&gt;Password \u00a0 = $password; \u00a0\/\/ GMAIL password\n\u00a0 \u00a0 $result = $mailer-&gt;Send();\u00a0 \n\u00a0 \u00a0 echo \"Mail sentn\";\n\u00a0 } catch \u00a0(Exception $e) {\n\u00a0 \u00a0 echo 'Message could not be sent. Mailer Error: ';\n\u00a0 \u00a0 var_dump($e);\n\u00a0 } \u00a0<\/code><\/pre>\n<p>\u041f\u043e\u043c\u043d\u0438\u0442\u0435, \u0447\u0442\u043e \u0432\u0430\u043c \u0442\u0430\u043a\u0436\u0435 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u043e\u0439 \u043f\u043e\u0447\u0442\u044b \u0432 \u043f\u043b\u0430\u0433\u0438\u043d\u0435 WordPress \u2014 <a href=\"https:\/\/wordpress.mediadoma.com\/ru\/kak-izbezhat-popadanija-pisem-wordpress-v-papku-spam\/\" title=\"SMTP\">SMTP<\/a>. \u0418 \u0443\u0431\u0435\u0434\u0438\u0442\u0435\u0441\u044c, \u0447\u0442\u043e \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0443\u0447\u0435\u0442\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f Gmail, \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u0435 \u0432 \u0444\u0430\u0439\u043b\u0435 wp-settings.php.<\/p>\n<pre><code>define( 'WPMS_ON', true );\ndefine( 'WPMS_SMTP_PASS', 'You GMAIL App Password' );<\/code><\/pre>\n<p><div id=\"PostUnique_PostSource\" style=\"padding-top: 50px\">\u0418\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0437\u0430\u043f\u0438\u0441\u0438:  <a target=\"_blank\" rel=\"noopener nofollow\" href=\"\/\/helloacm.com\" class=\"external external_icon\">helloacm.com<\/a><\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u041a\u0430\u043a \u0440\u0435\u0448\u0438\u0442\u044c SMTP: \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0430\u0443\u0442\u0435\u043d\u0442\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Gmail + PHPMailer?<\/p>\n","protected":false},"author":1,"featured_media":224603,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_wp_rev_ctl_limit":""},"categories":[954,900,921,850],"tags":[1171],"class_list":["post-220013","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-google-ru","category-kod-2","category-drugoj","category-uchebniki-ru","tag-affiai-ru"],"_links":{"self":[{"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/posts\/220013","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/comments?post=220013"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/posts\/220013\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/media\/224603"}],"wp:attachment":[{"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/media?parent=220013"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/categories?post=220013"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wordpress.mediadoma.com\/ru\/wp-json\/wp\/v2\/tags?post=220013"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}