Email, smtp connect failed phpmailer


WordPress is the most widely used CMS for websites. Sending out mails from WordPress is required in scenarios such as tương tác form submissions or password resets.

Bạn đang xem: Email, smtp connect failed phpmailer

‘SMTP connect() failed‘ is a commonly encountered errorin WordPress, due to which emails fail khổng lồ be send from your WordPress site.

Configuring email settings in WordPress

By Default, WordPress uses the PHP Mail function to send emails. But using PHP mail function is a less secure method and makes the vps vulnerable to lớn spamming.

As a result, many webservers have PHP mail() function disabled for security purposes. In those servers, mails can be send from WordPress using SMTP.

SMTP uses proper authentication and is therefore more secure. There are WordPress plugins such as ‘WP Mail SMTP‘, that has lớn be configured to send mails via SMTP.

Once the SMTP plugin is activated, a new ‘Email‘ thực đơn will show up under the Settings in WP.You can configure the thư điện tử delivery settings in that option.


Configure SMTP plugin in WordPress

You can give your e-mail address, password, mail hệ thống name & port in the email settings & save it.You can demo the mail delivery to see if the settings are fine.

The following settings can be configured in the thư điện tử settings:

From Email - the e-mail address you want to send emails fromFrom Name - the name that your emails will be received fromMailer - you can choose between the default PHP Mail function và SMTPSMTP Host - the hostname for your SMTP serverSMTP Port - the port for your mail server, usually 25Encryption - if you want to enable SSL/TLS encryption for the mail serverAuthentication - kiểm tra it for mail vps authenticationUsername - the username for your SMTP serverPassword - the password for your SMTP vps

What causes error ‘SMTP connect() failed’ in WordPress

The mặc định mailer is PHPMailer in WordPress và many sitesuse it khổng lồ send mails. But it can give‘SMTP connect() failed’error ifPHPMailer is unable to contact the SMTP server.


SMTP connect() failed error in WordPress

Also, if the settings for the SMTP serveris not configured correctly, it will not send mails successfully from the server and give ‘SMTP connect() failed’error.

The error‘SMTP connect() failed’ can be caused due lớn the many reasons, which we’ll discuss one by one.

Wrong username và password given in SMTP authentication.SMTP port blocked in mail server firewalls.SSL/TLS not tư vấn in mail server & encryption is enabled in WP setting.Security restrictions by3rd party servers such as email or thư điện tử apps.Upgrades lớn WordPress pluginorPHPMailerversions that have enhancedsecurity features or bugs.

How lớn fix error ‘SMTP connect() failed’ in WordPress

to lớn fix the error, first thing is to do is lớn identify the cause for the error, by checking và ruling out each possibility.

1. SMTP host và port settings

Enter the name of your mail hệ thống in ‘SMTP Host’ section. This is usually the ‘domain name’ or ‘’. Make sure that the DNS for SMTP host resolves correctly.

Give port number as 25, the default SMTP port. Formail servers that use custom ports such as 587 for SMTP khổng lồ avoid spamming, give that port.

It is also possible that certain mail servers restrict the access to their port 25 using firewall rules. In such cases, your IP should be white-listed in the firewall lớn avoid SMTP error.

To confirm that the connectivity to SMTP server and port is working fine, use the command:

telnet 25 Usethe appropriate hostname và port number, after confirming that the SMTP connection is working fine.

If the connectivity fails khổng lồ establish, mail delivery will fail with the error ‘SMTP connect() failed‘.

Xem thêm: Giới thiệu giới thiệu 567 live app ứng dụng livestream chơi game kết hợp hấp dẫn.

2. SMTP authentication details

Every mail server has an authentication system lớn validate the users before allowing them khổng lồ connect to lớn it & send mails. In your WordPressEmail settings, enter these details.

Give the e-mail account username và password. Enter the full ‘user’ as the username in case of non-default accounts.

Whenever the thư điện tử account password is changed or updated for security reasons, vày not forget lớn change the password in ‘Email settings’ also.

If the authentication details given are wrong, WordPresswill fail khổng lồ send mails và give the error ‘SMTP connect() failed‘.

3. SMTP encryption settings

For secure thư điện tử transmission, it is always advisable lớn choose SMTP with encryption. This can be done using‘Use SSL encryption’ option in WordPress setting.

But is some thư điện tử servers, this SSL/TLS tư vấn may not be enabled. In those cases, if you choose encryption, mails may not get delivered.

Make sure that the ‘openssl’ utility is configured properly in your email server. Also,verify the SSL certificate for your mail server, using the command:

openssl s_client -starttls smtp -crlf -connect Using expired or self-signed certificates can cause the mail delivery using SSL to lớn fail & give error ‘SMTP connect() failed‘.

So the solution in those cases is to lớn configure SSL for your mail server properly or change the SMTP encryption to‘No Encryption’, which is less secure one.

4. Tư vấn for 3rd buổi tiệc ngọt apps

Gmail servers have a lot of security restrictions in place, which may cause them to block attempts from certain mail client apps.

In those cases, you will have lớn loosen the security measures.In gmail, go to lớn ‘My Account’ -> ‘Less Secure Apps‘ section, và turn on the option ‘Access for less secure apps‘.


Allow less secure apps in email account

If you are using gmail as your mail server, then a better option is to lớn install and activate the ‘Gmail SMTP’ plugin for WordPress.

5. WordPress SMTP plugins

Lastly, the SMTP plugin related issues can also cause ‘SMTP connect failed’ error. In those cases, you will have khổng lồ stop using ‘WP Mail SMTP’ plugin and choose other ones.

Some WordPress SMTP plugins that can be used are Postman SMTP Mailer, Mailgun, etc. For sending mails from WordPress sites.

In short..

Other variants for ‘SMTP connect() failed’error are ‘Called Mail() without being connected’ or ‘SMTP Error: Could not connect to SMTP host.’

In addition to the configuration settings we’ve discussed, one important point lớn keep in mind is the safety precautions to lớn take during WordPressor PHPMailer upgrades.

At, our hands-on experience with both WordPresscustomization and server administration has helped us lớn perform upgrades và fixes in websites without causing any business downtime.

If you’d like to know how khổng lồ secure and manage your servers & customize your websites lớn prevent errors, we’d behappy to talk lớn you.

Chuyên mục: Domain Hosting