{"id":30745,"date":"2024-11-25T13:57:59","date_gmt":"2024-11-25T05:57:59","guid":{"rendered":"https:\/\/fwq.ai\/blog\/30745\/"},"modified":"2024-11-25T13:57:59","modified_gmt":"2024-11-25T05:57:59","slug":"%e5%a6%82%e4%bd%95%e6%ad%a3%e7%a1%ae%e9%85%8d%e7%bd%ae-wordpress-%e9%82%ae%e4%bb%b6smtp","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/30745\/","title":{"rendered":"\u5982\u4f55\u6b63\u786e\u914d\u7f6e WordPress \u90ae\u4ef6SMTP"},"content":{"rendered":"<p>\u4e0b\u9762\u7531\/&#8221; target=&#8221;_blank&#8221;&gt;<strong>wordpress\u6559\u7a0b<\/strong>\u680f\u76ee\u7ed9\u5927\u5bb6\u4ecb\u7ecd\u6b63\u786e\u914d\u7f6e wordpress \u90ae\u4ef6smtp\u7684\u65b9\u6cd5\uff0c\u5e0c\u671b\u5bf9\u9700\u8981\u7684\u670b\u53cb\u6709\u6240\u5e2e\u52a9\uff01<\/p>\n<p>\u9ed8\u8ba4\u5927\u90e8\u5206\u4e3b\u673a\u7a7a\u95f4\u90fd\u65e0\u6cd5\u6b63\u5e38\u53d1\u9001\u90ae\u4ef6\uff0c\u9020\u6210\u7528\u6237\u6ce8\u518c\u4e0d\u80fd\u9001\u90ae\u4ef6\u3001\u65e0\u6cd5\u627e\u56de\u5bc6\u7801\u7b49\uff0c\u56e0\u6b64\u9700\u8981\u7528\u7b2c\u4e09\u65b9\u90ae\u4ef6\u670d\u52a1\u5668SMTP\u65b9\u5f0f\u4ee3\u66ff WordPress \u9ed8\u8ba4mail()\u51fd\u6570\u3002<\/p>\n<p style=\"text-align: center\"><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/000\/000\/020\/5e0986232421e422.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u6b63\u786e\u914d\u7f6e WordPress \u90ae\u4ef6SMTP\u63d2\u56fe\" alt=\"\u5982\u4f55\u6b63\u786e\u914d\u7f6e WordPress \u90ae\u4ef6SMTP\u63d2\u56fe\" \/><\/p>\n<p>\u76f8\u4fe1\u5f88\u591a\u7ad9\u957f\u90fd\u770b\u8fc7\u7f51\u4e0a\u5230\u5904\u98de\u7684\u914d\u7f6eWordPress \u90ae\u4ef6SMTP\u65b9\u6cd5\uff0c\u4f46\u8bd5\u8fc7\u4e4b\u540e\uff0c\u603b\u662f\u4e0d\u6210\u529f\uff0c\u4f8b\u5982\uff1a<\/p>\n<pre>\/\/&nbsp;\u914d\u7f6e\u90ae\u4ef6\nadd_action('phpmailer_init',&nbsp;'mail_smtp');\nfunction&nbsp;mail_smtp(&nbsp;$phpmailer&nbsp;)&nbsp;{\n$phpmailer-&amp;gt;FromName&nbsp;=&nbsp;'\u77e5\u66f4\u9e1f';&nbsp;\/\/&nbsp;\u53d1\u4ef6\u4eba\u6635\u79f0\n$phpmailer-&amp;gt;Host&nbsp;=&nbsp;'smtp.qq.com';&nbsp;\/\/&nbsp;\u90ae\u7bb1SMTP\u670d\u52a1\u5668\n$phpmailer-&amp;gt;Port&nbsp;=&nbsp;465;&nbsp;\/\/&nbsp;SMTP\u7aef\u53e3\uff0c\u4e0d\u9700\u8981\u6539\n$phpmailer-&amp;gt;Username&nbsp;=&nbsp;'123456@qq.com';&nbsp;\/\/&nbsp;\u90ae\u7bb1\u8d26\u6237\n$phpmailer-&amp;gt;Password&nbsp;=&nbsp;'aabbccddffgg';&nbsp;\/\/&nbsp;\u6b64\u5904\u586b\u5199\u90ae\u7bb1\u751f\u6210\u7684\u6388\u6743\u7801\uff0c\u4e0d\u662f\u90ae\u7bb1\u767b\u5f55\u5bc6\u7801\n$phpmailer-&amp;gt;From&nbsp;=&nbsp;'123456@qq.com';&nbsp;\/\/&nbsp;\u6536\u4ef6\u90ae\u7bb1\u8d26\u6237\n$phpmailer-&amp;gt;SMTPAuth&nbsp;=&nbsp;true;\n$phpmailer-&amp;gt;SMTPSecure&nbsp;=&nbsp;'ssl';&nbsp;\/\/&nbsp;\u7aef\u53e325\u65f6&nbsp;\u7559\u7a7a\uff0c465\u65f6&nbsp;ssl\uff0c\u4e0d\u9700\u8981\u6539\n$phpmailer-&amp;gt;IsSMTP();\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5927\u90e8\u5206\u63d0\u4f9b\u914d\u7f6e\u4ee3\u7801\u7684\u8bf4\u660e\u4e2d\u6ca1\u6709\u660e\u786e\u5199\u660e\u7b2c8\u884c$phpmailer-&gt;Password \u914d\u7f6e\u4e2d\u7684\u5bc6\u7801\u662f\u90ae\u7bb1\u7b2c\u4e09\u65b9\u6388\u6743\u7801\uff0c\u800c\u4e0d\u662f\u90ae\u7bb1\u7684\u767b\u5f55\u5bc6\u7801\uff0c\u8fd9\u662f\u4e0d\u80fd\u6210\u529f\u53d1\u90ae\u4ef6\u7684\u5173\u952e\u4e4b\u5904\u3002<\/p>\n<p>\u4e0b\u9762\u4ec5\u4ee5QQ\u90ae\u7bb1\u4e3a\u4f8b\uff0c\u7b80\u5355\u8bf4\u4e00\u4e0b\u5982\u4f55\u5f00\u542f\u90ae\u7bb1IMAP\/SMTP\u670d\u52a1\u548c\u83b7\u5f97\u7b2c\u4e09\u65b9\u6388\u6743\u7801\u3002<\/p>\n<p>\u9996\u5148\u5c06\u4e0a\u9762\u7684\u4ee3\u7801\u6dfb\u52a0\u5230\u5f53\u524d\u4e3b\u9898\u51fd\u6570\u6a21\u677ffunctions.php\u4e2d\uff0c\u5e76\u4fee\u6539\u5176\u4e2d\u7684\u76f8\u5173\u4fe1\u606f\u3002<\/p>\n<p><strong>\u5f00\u542fIMAP\/SMTP\u670d\u52a1<\/strong><\/p>\n<p>\u767b\u5f55\u4f60\u7684QQ\u90ae\u7bb1\uff0c\u4f9d\u6b21\u70b9\u51fb\uff0c\u8bbe\u7f6e \u2192 \u8d26\u6237\uff0c\u627e\u5230\u201cPOP3\/IMAP\/SMTP\/Exchange\/CardDAV\/CalDAV\u670d\u52a1\u201d\u8bbe\u7f6e\u9009\u9879\uff0c\u5f00\u542f\u90ae\u7bb1\u201cIMAP\/SMTP\u670d\u52a1\u201d\u3002<\/p>\n<p><strong>\u83b7\u53d6\u6388\u6743\u7801<\/strong><\/p>\n<p>\u70b9\u51fb\u4e0b\u9762\u7684\u201c\u751f\u6210\u6388\u6743\u7801 \u201d\uff0c\u6309\u8981\u6c42\u53d1\u9001\u77ed\u4fe1\uff1a\u914d\u7f6e\u90ae\u4ef6\u5ba2\u6237\u7aef\uff0c\u5230\u6307\u5b9a\u7684\u53f7\u7801\uff0c\u4e4b\u540e\u70b9\u51fb\u201c\u6211\u5df2\u53d1\u9001\u201d\uff0c\u4f1a\u81ea\u52a8\u751f\u4e00\u4e2a\u6388\u6743\u7801\uff0c\u8981\u8bb0\u597d\u8fd9\u4e2a\u6388\u6743\u7801\uff0c\u56e0\u4e3a\u53ea\u663e\u793a\u4e00\u6b21\uff0c\u6ca1\u8bb0\u4f4f\u53ea\u80fd\u518d\u6b21\u53d1\u9001\u77ed\u4fe1\u4e86\uff0c\u5c06\u8fd9\u4e2a\u6388\u6743\u7801\u586b\u5199\u5230\u914d\u7f6e\u4fe1\u606f\u4e2d\u5373\u53ef\u3002<\/p>\n<p>\u6211\u81ea\u5df1\u53ea\u8bd5\u8fc7QQ\u90ae\u7bb1\u548c126\u7684\uff0c\u5176\u5b83\u90ae\u7bb1\u65b9\u6cd5\u7c7b\u4f3c\u3002<\/p>\n<p>\u6ce8\uff1a\u8c8c\u4f3c\u76ee\u524d\u6240\u6709\u90ae\u7bb1\u7aef\u53e3\u90fd\u53ef\u4ee5\u8bbe\u7f6e\u4e3a465\uff0c\u90fd\u652f\u6301ssl\u52a0\u5bc6<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u6b63\u786e\u914d\u7f6e WordPress \u90ae\u4ef6SMTP\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e0b\u9762\u7531\/&#8221; target=&#8221;_blank&#8221;&gt;wordpress\u6559\u7a0b\u680f\u76ee\u7ed9\u5927\u5bb6\u4ecb\u7ecd\u6b63\u786e\u914d\u7f6e wordpress \u90ae\u4ef6smtp\u7684\u65b9\u6cd5\uff0c\u5e0c\u671b\u5bf9\u9700\u8981\u7684\u670b\u53cb\u6709\u6240\u5e2e\u52a9\uff01 \u9ed8\u8ba4\u5927\u90e8\u5206\u4e3b\u673a\u7a7a\u95f4\u90fd\u65e0\u6cd5\u6b63\u5e38\u53d1\u9001\u90ae\u4ef6\uff0c\u9020\u6210\u7528\u6237\u6ce8\u518c\u4e0d\u80fd\u9001\u90ae\u4ef6\u3001\u65e0\u6cd5\u627e\u56de\u5bc6\u7801\u7b49\uff0c\u56e0\u6b64\u9700\u8981\u7528\u7b2c\u4e09\u65b9\u90ae\u4ef6\u670d\u52a1\u5668SMTP\u65b9\u5f0f\u4ee3\u66ff WordPress \u9ed8\u8ba4mail()\u51fd\u6570\u3002 \u76f8\u4fe1\u5f88\u591a\u7ad9\u957f\u90fd\u770b\u8fc7\u7f51\u4e0a\u5230\u5904\u98de\u7684\u914d\u7f6eWordPress \u90ae\u4ef6SMTP\u65b9\u6cd5\uff0c\u4f46\u8bd5\u8fc7\u4e4b\u540e\uff0c\u603b\u662f\u4e0d\u6210\u529f\uff0c\u4f8b\u5982\uff1a \/\/&nbsp;\u914d\u7f6e\u90ae\u4ef6 add_action(&#8216;phpmailer_init&#8217;,&nbsp;&#8216;mail_smtp&#8217;); function&nbsp;mail_smtp(&nbsp;$phpmailer&nbsp;)&nbsp;{ $phpmailer-&amp;gt;FromName&nbsp;=&nbsp;&#8216;\u77e5\u66f4\u9e1f&#8217;;&nbsp;\/\/&nbsp;\u53d1\u4ef6\u4eba\u6635\u79f0 $phpmailer-&amp;gt;Host&nbsp;=&nbsp;&#8216;smtp.qq.com&#8217;;&nbsp;\/\/&nbsp;\u90ae\u7bb1SMTP\u670d\u52a1\u5668 $phpmailer-&amp;gt;Port&nbsp;=&nbsp;465;&nbsp;\/\/&nbsp;SMTP\u7aef\u53e3\uff0c\u4e0d\u9700\u8981\u6539 $phpmailer-&amp;gt;Username&nbsp;=&nbsp;&#8216;123456@qq.com&#8217;;&nbsp;\/\/&nbsp;\u90ae\u7bb1\u8d26\u6237 $phpmailer-&amp;gt;Password&nbsp;=&nbsp;&#8216;aabbccddffgg&#8217;;&nbsp;\/\/&nbsp;\u6b64\u5904\u586b\u5199\u90ae\u7bb1\u751f\u6210\u7684\u6388\u6743\u7801\uff0c\u4e0d\u662f\u90ae\u7bb1\u767b\u5f55\u5bc6\u7801 $phpmailer-&amp;gt;From&nbsp;=&nbsp;&#8216;123456@qq.com&#8217;;&nbsp;\/\/&nbsp;\u6536\u4ef6\u90ae\u7bb1\u8d26\u6237 $phpmailer-&amp;gt;SMTPAuth&nbsp;=&nbsp;true; $phpmailer-&amp;gt;SMTPSecure&nbsp;=&nbsp;&#8216;ssl&#8217;;&nbsp;\/\/&nbsp;\u7aef\u53e325\u65f6&nbsp;\u7559\u7a7a\uff0c465\u65f6&nbsp;ssl\uff0c\u4e0d\u9700\u8981\u6539 $phpmailer-&amp;gt;IsSMTP(); } \u767b\u5f55\u540e\u590d\u5236 \u5927\u90e8\u5206\u63d0\u4f9b\u914d\u7f6e\u4ee3\u7801\u7684\u8bf4\u660e\u4e2d\u6ca1\u6709\u660e\u786e\u5199\u660e\u7b2c8\u884c$phpmailer-&gt;Password \u914d\u7f6e\u4e2d\u7684\u5bc6\u7801\u662f\u90ae\u7bb1\u7b2c\u4e09\u65b9\u6388\u6743\u7801\uff0c\u800c\u4e0d\u662f\u90ae\u7bb1\u7684\u767b\u5f55\u5bc6\u7801\uff0c\u8fd9\u662f\u4e0d\u80fd\u6210\u529f\u53d1\u90ae\u4ef6\u7684\u5173\u952e\u4e4b\u5904\u3002 \u4e0b\u9762\u4ec5\u4ee5QQ\u90ae\u7bb1\u4e3a\u4f8b\uff0c\u7b80\u5355\u8bf4\u4e00\u4e0b\u5982\u4f55\u5f00\u542f\u90ae\u7bb1IMAP\/SMTP\u670d\u52a1\u548c\u83b7\u5f97\u7b2c\u4e09\u65b9\u6388\u6743\u7801\u3002 \u9996\u5148\u5c06\u4e0a\u9762\u7684\u4ee3\u7801\u6dfb\u52a0\u5230\u5f53\u524d\u4e3b\u9898\u51fd\u6570\u6a21\u677ffunctions.php\u4e2d\uff0c\u5e76\u4fee\u6539\u5176\u4e2d\u7684\u76f8\u5173\u4fe1\u606f\u3002 \u5f00\u542fIMAP\/SMTP\u670d\u52a1 \u767b\u5f55\u4f60\u7684QQ\u90ae\u7bb1\uff0c\u4f9d\u6b21\u70b9\u51fb\uff0c\u8bbe\u7f6e \u2192 \u8d26\u6237\uff0c\u627e\u5230\u201cPOP3\/IMAP\/SMTP\/Exchange\/CardDAV\/CalDAV\u670d\u52a1\u201d\u8bbe\u7f6e\u9009\u9879\uff0c\u5f00\u542f\u90ae\u7bb1\u201cIMAP\/SMTP\u670d\u52a1\u201d\u3002 \u83b7\u53d6\u6388\u6743\u7801 \u70b9\u51fb\u4e0b\u9762\u7684\u201c\u751f\u6210\u6388\u6743\u7801 \u201d\uff0c\u6309\u8981\u6c42\u53d1\u9001\u77ed\u4fe1\uff1a\u914d\u7f6e\u90ae\u4ef6\u5ba2\u6237\u7aef\uff0c\u5230\u6307\u5b9a\u7684\u53f7\u7801\uff0c\u4e4b\u540e\u70b9\u51fb\u201c\u6211\u5df2\u53d1\u9001\u201d\uff0c\u4f1a\u81ea\u52a8\u751f\u4e00\u4e2a\u6388\u6743\u7801\uff0c\u8981\u8bb0\u597d\u8fd9\u4e2a\u6388\u6743\u7801\uff0c\u56e0\u4e3a\u53ea\u663e\u793a\u4e00\u6b21\uff0c\u6ca1\u8bb0\u4f4f\u53ea\u80fd\u518d\u6b21\u53d1\u9001\u77ed\u4fe1\u4e86\uff0c\u5c06\u8fd9\u4e2a\u6388\u6743\u7801\u586b\u5199\u5230\u914d\u7f6e\u4fe1\u606f\u4e2d\u5373\u53ef\u3002 \u6211\u81ea\u5df1\u53ea\u8bd5\u8fc7QQ\u90ae\u7bb1\u548c126\u7684\uff0c\u5176\u5b83\u90ae\u7bb1\u65b9\u6cd5\u7c7b\u4f3c\u3002 \u6ce8\uff1a\u8c8c\u4f3c\u76ee\u524d\u6240\u6709\u90ae\u7bb1\u7aef\u53e3\u90fd\u53ef\u4ee5\u8bbe\u7f6e\u4e3a465\uff0c\u90fd\u652f\u6301ssl\u52a0\u5bc6 \u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u6b63\u786e\u914d\u7f6e WordPress \u90ae\u4ef6SMTP\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[18],"tags":[],"class_list":["post-30745","post","type-post","status-publish","format-standard","hentry","category-cms"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/30745","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=30745"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/30745\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=30745"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=30745"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=30745"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}