{"id":1509,"date":"2021-03-20T09:28:19","date_gmt":"2021-03-20T08:28:19","guid":{"rendered":"https:\/\/ekiwi.de\/?p=1509"},"modified":"2021-03-20T09:28:19","modified_gmt":"2021-03-20T08:28:19","slug":"phpmailer-smtp-error-could-not-connect-to-smtp-host","status":"publish","type":"post","link":"https:\/\/ekiwi.de\/index.php\/1509\/phpmailer-smtp-error-could-not-connect-to-smtp-host\/","title":{"rendered":"PHPMailer &#8211; SMTP Error: Could not connect to SMTP host"},"content":{"rendered":"<p>Beim Versand mit PHPMailer \u00fcber SMTP kann keine Verbindung hergestellt werden. <\/p>\n<p><!--more--><\/p>\n<p>Beim Versuch eine Mail \u00fcber SMTP mit PHPMailer zu versenden hatte ich folgenden Fehler, nach dem <a href=\"https:\/\/da-software.net\/2020\/06\/smtp-debugging-im-formmail-script-aktivieren\/\" target=\"_blank\" rel=\"noopener\">aktivieren des SMTP-Debug-Logs vom PHPMailer<\/a>:<\/p>\n<blockquote><p>\n2021-03-20 08:14:35 SERVER -> CLIENT: 220 server.de ESMTP Postfix<br \/>\n2021-03-20 08:14:35 CLIENT -> SERVER: EHLO server.de<br \/>\n2021-03-20 08:14:35 SERVER -> CLIENT: 250-server.de250-PIPELINING250-SIZE 209715200250-ETRN250-STARTTLS250-AUTH DIGEST-MD5 CRAM-MD5 PLAIN LOGIN250-XFORWARD NAME ADDR PROTO HELO SOURCE PORT IDENT250-ENHANCEDSTATUSCODES250-8BITMIME250-DSN250 CHUNKING<br \/>\n2021-03-20 08:14:35 CLIENT -> SERVER: STARTTLS<br \/>\n2021-03-20 08:14:35 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS<br \/>\nSMTP Error: Could not connect to SMTP host.<br \/>\n2021-03-20 08:14:35 CLIENT -> SERVER: QUIT<br \/>\n2021-03-20 08:14:35 SERVER -> CLIENT:<br \/>\n2021-03-20 08:14:35 SMTP ERROR: QUIT command failed:<br \/>\nSMTP connect() failed. https:\/\/github.com\/PHPMailer\/PHPMailer\/wiki\/Troubleshooting<br \/>\nMailer Error: SMTP connect() failed. https:\/\/github.com\/PHPMailer\/PHPMailer\/wiki\/Troubleshooting\n<\/p><\/blockquote>\n<p>Die Verbindung wurde verweigert. Eine Ursache kann sein, dass der Mailserver kein offizielles Zertifikat hat oder das Zertifikat nicht zum Host passt. In diesem Fall kann man dies mit den folgenden Einstellungen behoben.<\/p>\n<pre>\r\n$mailer-&gt;SMTPOptions = array(\r\n    'ssl' =&gt; array(\r\n        'verify_peer' =&gt; false,\r\n        'verify_peer_name' =&gt; false,\r\n        'allow_self_signed' =&gt; true\r\n    )\r\n    );<\/pre>\n<p>Der Code deaktiviert die \u00dcberpr\u00fcfung der Zertifikate.<\/p>","protected":false},"excerpt":{"rendered":"<p>Beim Versand mit PHPMailer \u00fcber SMTP kann keine Verbindung hergestellt werden.<\/p>\n","protected":false},"author":1,"featured_media":174,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","_links_to":"","_links_to_target":""},"categories":[14],"tags":[31],"class_list":["post-1509","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php","tag-php"],"_links":{"self":[{"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/posts\/1509","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/comments?post=1509"}],"version-history":[{"count":0,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/posts\/1509\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/media\/174"}],"wp:attachment":[{"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/media?parent=1509"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/categories?post=1509"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ekiwi.de\/index.php\/wp-json\/wp\/v2\/tags?post=1509"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}