{"id":16024,"date":"2020-10-21T17:42:21","date_gmt":"2020-10-21T10:42:21","guid":{"rendered":"https:\/\/blog.tinohost.com\/?p=7220"},"modified":"2025-06-11T16:24:34","modified_gmt":"2025-06-11T09:24:34","slug":"loi-smtp-error","status":"publish","type":"post","link":"https:\/\/tino.vn\/blog\/loi-smtp-error\/","title":{"rendered":"Fix l\u1ed7i &#8220;SMTP error: Could not connect to SMTP host WordPress!&#8221;"},"content":{"rendered":"<h2 id=\"D\u1ea5u_hi\u1ec7u_nh\u1eadn_bi\u1ebft_l\u1ed7i_\u201cSMTP_Error:_Could_not_connect_to_SMTP_host_WordPress!\u201d\"><strong>D\u1ea5u hi\u1ec7u nh\u1eadn bi\u1ebft l\u1ed7i \u201cSMTP Error: Could not connect to SMTP host WordPress!\u201d<\/strong><\/h2>\n<span style=\"font-weight: 400;\">B\u1ea1n c\u00f3 th\u1ec3 ph\u00e1t hi\u1ec7n m\u00ecnh g\u1eb7p l\u1ed7i n\u00e0y khi:\u00a0<\/span>\n<ul>\n \t<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">SMTP connect() failed\u00a0<\/span><\/li>\n \t<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Ho\u1eb7c Called Mail() without being connected trong output debug.\u00a0<\/span><\/li>\n<\/ul>\n<span style=\"font-weight: 400;\">M\u1ed9t trong hai d\u1ea5u hi\u1ec7u n\u00e0y th\u00f4ng b\u00e1o v\u1edbi b\u1ea1n r\u1eb1ng: PHPMailer \u0111ang g\u1eb7p m\u1ed9t s\u1ed1 v\u1ea5n \u0111\u1ec1 tr\u1ee5c tr\u1eb7c, b\u1ea1n c\u1ea5u h\u00ecnh DNS th\u1ea5t b\u1ea1i, t\u01b0\u1eddng l\u1eeda c\u1ee7a webservers ho\u1eb7c k\u1ebft n\u1ed1i m\u1ea1ng c\u00f3 v\u1ea5n \u0111\u1ec1.<\/span>\n<span style=\"font-weight: 400;\">L\u1ed7i n\u00e0y th\u1ec3 hi\u1ec7n cho b\u1ea1n bi\u1ebft l\u00e0 hi\u1ec7n PHPMailer kh\u00f4ng th\u1ec3 li\u00ean l\u1ea1c v\u1edbi m\u00e1y ch\u1ee7 SMTP b\u1ea1n \u0111\u00e3 ch\u1ec9 \u0111\u1ecbnh trong c\u1ea5u h\u00ecnh. Tuy nhi\u00ean, l\u00fd do ch\u00ednh x\u00e1c th\u00ec v\u1eabn kh\u00f4ng ch\u1ec9 r\u00f5.\u00a0<\/span>\n<h2 id=\"Nguy\u00ean_nh\u00e2n_v\u00e0_c\u00e1ch_kh\u1eafc_ph\u1ee5c\"><strong>Nguy\u00ean nh\u00e2n v\u00e0 c\u00e1ch kh\u1eafc ph\u1ee5c<\/strong><\/h2>\n<span style=\"font-weight: 400;\">C\u00f3 2 nguy\u00ean nh\u00e2n ch\u00ednh g\u00e2y ra l\u1ed7i &#8220;SMTP error: Could not connect to SMTP host WordPress!&#8221;<\/span>\n<h3 id=\"Tr\u01b0\u1eddng_h\u1ee3p_1:_Ch\u01b0a_b\u1eadt_openSSL\"><strong>Tr\u01b0\u1eddng h\u1ee3p 1: Ch\u01b0a b\u1eadt openSSL<\/strong><\/h3>\n<span style=\"font-weight: 400;\">Kh\u1eafc ph\u1ee5c:\u00a0\u00a0<\/span>\n<ul>\n \t<li><span style=\"font-weight: 400;\">B\u01b0\u1edbc 1: B\u1ea1n t\u00ecm <code>extension=php_openssl.dll\u00a0<\/code> trong <code>php.ini.<\/code><\/span><\/li>\n \t<li><span style=\"font-weight: 400;\">B\u01b0\u1edbc 2: X\u00f3a d\u1ea5u ; tr\u01b0\u1edbc <code>extension=php_openssl.dll<\/code><\/span><\/li>\n<\/ul>\n<span style=\"font-weight: 400;\">N\u1ebfu kh\u00f4ng t\u00ecm th\u1ea5y nh\u01b0 tr\u00ean, b\u1ea1n c\u00f3 th\u1ec3 th\u00eam v\u00e0o 1 d\u00f2ng\u00a0<code> extension=php_openssl.dll<\/code><\/span>\n<h3 id=\"Tr\u01b0\u1eddng_h\u1ee3p_2:_H\u1ec7_th\u1ed1ng_Firewall_c\u1ee7a_VPS_\u0111\u00e3_block_c\u00e1c_c\u1ed5ng_SMTP_ra_25,_465_v\u00e0_587.\"><strong>Tr\u01b0\u1eddng h\u1ee3p 2: H\u1ec7 th\u1ed1ng Firewall c\u1ee7a VPS \u0111\u00e3 block c\u00e1c c\u1ed5ng SMTP ra 25, 465 v\u00e0 587.<\/strong><\/h3>\n<span style=\"font-weight: 400;\">B\u1ea1n c\u00f3 th\u1ec3 t\u1eaft h\u1ec7 th\u1ed1ng Firewall \u0111\u1ec3 kh\u1eafc ph\u1ee5c.<\/span>\n<span style=\"font-weight: 400;\">\u0110\u1ed1i v\u1edbi trong CWP(Centos web panel), h\u1ec7 th\u1ed1ng Firewall ch\u00ednh l\u00e0 CSF Firewall.\u00a0<\/span>\n<span style=\"font-weight: 400;\"> B\u1ea1n c\u00f3 th\u1ec3 m\u1edf ch\u1eb7n c\u00e1c port ra b\u1eb1ng c\u00e1c ch\u1ec9nh file<strong> \/etc\/csf\/csf.conf<\/strong><\/span>\n<span style=\"font-weight: 400;\">B\u01b0\u1edbc 1: T\u00ecm c\u00e1c d\u00f2ng \u0111o\u1ea1n sau:<\/span>\n<strong><code># Allow outgoing TCP ports<\/code><\/strong>\n<strong><code>TCP_OUT = \"20,21,22,25,53,80,110,113,443,2030,2031,587,993,995\"<\/code><\/strong>\n<strong><code># Allow outgoing IPv6 TCP ports<\/code><\/strong>\n<strong><code>TCP6_OUT = \"20,21,22,25,53,80,110,113,443,2030,2031,587,993,995\"<\/code><\/strong>\n<strong><code>SMTP_BLOCK = \"1\"<\/code><\/strong>\n<span style=\"font-weight: 400;\">B\u01b0\u1edbc 2: Sau \u0111\u00f3, b\u1ea1n th\u00eam v\u00e0o c\u00e1c port 25, 465 v\u00e0 587 c\u00f2n thi\u1ebfu.<\/span>\n<strong><code># Allow outgoing TCP ports<\/code><\/strong>\n<strong><code>TCP_OUT = \"20,21,22,25,53,80,110,113,443,2030,2031,587,993,995,465\"<\/code><\/strong>\n<strong><code>\u00a0# Allow outgoing IPv6 TCP ports<\/code><\/strong>\n<strong><code>TCP6_OUT = \"20,21,22,25,53,80,110,113,443,2030,2031,587,993,995,465\"<\/code><\/strong>\n<span style=\"font-weight: 400;\"><img decoding=\"async\" class=\"size-full wp-image-7223 aligncenter\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2020\/10\/Screen-Shot-2020-10-21-at-5.40.33-PM.png\" alt=\"loi-smtp-error\" width=\"672\" height=\"623\" title=\"\">Sau \u0111\u00f3, b\u1ea1n ti\u1ebfn h\u00e0nh reboot l\u1ea1i m\u00e1y ch\u1ee7.<\/span>\n<span style=\"font-weight: 400;\">Tr\u00ean \u0111\u00e2y l\u00e0 2 nguy\u00ean nh\u00e2n c\u01a1 b\u1ea3n g\u00e2y l\u1ed7i &#8220;SMTP error: Could not connect to SMTP host WordPress!&#8221;.\u00a0<\/span>\n<span style=\"font-weight: 400;\">Sau khi kh\u1eafc ph\u1ee5c th\u00e0nh c\u00f4ng, b\u1ea1n c\u00f3 th\u1ec3 ti\u1ebfp t\u1ee5c t\u00ecm hi\u1ec3u ch\u00ednh x\u00e1c nguy\u00ean nh\u00e2n n\u00e0o \u0111\u00e3 tr\u1ef1c ti\u1ebfp g\u00e2y l\u1ed7i n\u00e0y. Th\u00f4ng th\u01b0\u1eddng, ng\u01b0\u1eddi d\u00f9ng hay m\u1eafc nh\u1eefng l\u1ed7i sau:\u00a0<\/span>\n<ul>\n \t<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">L\u1ed7i do c\u1ea5u h\u00ecnh SMTP kh\u00f4ng \u0111\u00fang.<\/span><\/li>\n \t<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">L\u1ed7i do t\u00e0i kho\u1ea3n email c\u1ea5u h\u00ecnh kh\u00f4ng \u0111\u00fang.<\/span><\/li>\n \t<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">L\u1ed7i do hosting ch\u1eb7n port g\u1eedi mail th\u00f4ng qua SMTP.<\/span><\/li>\n \t<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">L\u1ed7i do b\u1ed9 code g\u1eedi mail kh\u00f4ng ho\u1ea1t \u0111\u1ed9ng.<\/span><\/li>\n \t<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">L\u1ed7i do t\u00e0i kho\u1ea3n email c\u1ee7a b\u1ea1n v\u01b0\u1ee3t gi\u1edbi h\u1ea1n g\u1eedi mail mi\u1ec5n ph\u00ed h\u00e0ng ng\u00e0y.<\/span><\/li>\n<\/ul>\n<span style=\"font-weight: 400;\">Ch\u00fac b\u1ea1n t\u00ecm ra nguy\u00ean nh\u00e2n g\u00e2y l\u1ed7i v\u00e0 s\u1edbm kh\u1eafc ph\u1ee5c th\u00e0nh c\u00f4ng nh\u00e9!<\/span>\n<span style=\"font-weight: 400;\">M\u1ecdi th\u1eafc m\u1eafc v\u00e0 g\u00f3p \u00fd li\u00ean quan, xin vui l\u00f2ng<\/span><a href=\"https:\/\/tinohost.com\/lien-he\/\" target=\"_blank\" rel=\"noopener\"> <span style=\"font-weight: 400;\">li\u00ean h\u1ec7 ngay TinoHost<\/span><\/a><span style=\"font-weight: 400;\"> \u0111\u1ec3 \u0111\u01b0\u1ee3c t\u01b0 v\u1ea5n chi ti\u1ebft ho\u1eb7c<\/span><a href=\"https:\/\/www.facebook.com\/tinohostdotcom\/\" rel=\"nofollow noopener\" target=\"_blank\"> <span style=\"font-weight: 400;\">Fanpage<\/span><\/a><span style=\"font-weight: 400;\"> \u0111\u1ec3 c\u1eadp nh\u1eadt nh\u1eefng th\u00f4ng tin m\u1edbi nh\u1ea5t nh\u00e9!<\/span>\n<span style=\"font-weight: 400;\">V\u1edbi b\u1ec1 d\u00e0y kinh nghi\u1ec7m h\u01a1n 5 n\u0103m cung c\u1ea5p hosting, d\u1ecbch v\u1ee5 cho thu\u00ea m\u00e1y ch\u1ee7, c\u00e1c d\u1ecbch v\u1ee5 li\u00ean quan \u0111\u1ebfn t\u00ean mi\u1ec1n v\u00e0 b\u1ea3o m\u1eadt website, h\u00e3y \u0111\u1ec3 TinoHost \u0111\u1ed3ng h\u00e0nh c\u00f9ng b\u1ea1n tr\u00ean con \u0111\u01b0\u1eddng kh\u1eb3ng \u0111\u1ecbnh th\u01b0\u01a1ng hi\u1ec7u tr\u00ean b\u1ea3n \u0111\u1ed3 c\u00f4ng ngh\u1ec7 to\u00e0n c\u1ea7u!<\/span>\n<b><\/b>\n<ul>\n \t<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\"><\/span><span style=\"font-weight: 400;\">\n<\/span><span style=\"font-weight: 400;\"><\/span><\/li>\n \t<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\"><\/span><span style=\"font-weight: 400;\">\n<\/span><span style=\"font-weight: 400;\"><\/span><\/li>\n \t<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\"><\/span><\/li>\n \t<li style=\"font-weight: 400;\"><span style=\"font-weight: 400;\">Website: <\/span><a href=\"https:\/\/tinohost.com\/?aff=447\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\"><\/span><\/a><\/li>\n<\/ul>\n&nbsp;","protected":false},"excerpt":{"rendered":"<p>D\u1ea5u hi\u1ec7u nh\u1eadn bi\u1ebft l\u1ed7i \u201cSMTP Error: Could not connect to SMTP host WordPress!\u201d B\u1ea1n c\u00f3 th\u1ec3 ph\u00e1t hi\u1ec7n m\u00ecnh g\u1eb7p l\u1ed7i n\u00e0y khi:\u00a0 SMTP connect() failed\u00a0 Ho\u1eb7c Called Mail() without being connected trong output debug.\u00a0 M\u1ed9t trong hai d\u1ea5u hi\u1ec7u n\u00e0y th\u00f4ng b\u00e1o v\u1edbi b\u1ea1n r\u1eb1ng: PHPMailer \u0111ang g\u1eb7p m\u1ed9t s\u1ed1 v\u1ea5n \u0111\u1ec1 tr\u1ee5c [&hellip;]<\/p>\n","protected":false},"author":19,"featured_media":16025,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7377],"tags":[5632],"class_list":["post-16024","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-loi-thuong-gap","tag-smtp-error"],"_links":{"self":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/posts\/16024","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/comments?post=16024"}],"version-history":[{"count":1,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/posts\/16024\/revisions"}],"predecessor-version":[{"id":114755,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/posts\/16024\/revisions\/114755"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/media\/16025"}],"wp:attachment":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/media?parent=16024"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/categories?post=16024"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/tags?post=16024"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}