Smtp Connect() Failed

      15

WordPress is the most widely used CMS for websites. Sending out mails from WordPress is required in scenarios such as liên hệ form submissions or password resets.

Bạn đang xem: Smtp connect() failed

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

Configuring thư điện tử settings in WordPress

By Default, WordPress uses the PHP Mail function to send emails. But using PHP mail function is a less secure method và makes the hệ thống 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 to 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 e-mail delivery settings in that option.


*

Configure SMTP plugin in WordPress


You can give your email address, password, mail server name and port in the e-mail settings and save it.You can kiểm tra the mail delivery khổng lồ see if the settings are fine.

The following settings can be configured in the e-mail settings:

From Email - the email address you want to send emails fromFrom Name - the name that your emails will be received fromMailer - you can choose between the mặc định PHP Mail function and SMTPSMTP Host - the hostname for your SMTP serverSMTP Port - the port for your mail server, usually 25Encryption - if you want lớn enable SSL/TLS encryption for the mail serverAuthentication - check 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 default mailer is PHPMailer in WordPress & 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 & 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 vps firewalls.SSL/TLS not support in mail server và encryption is enabled in WP setting.Security restrictions by3rd party servers such as gmail or email apps.Upgrades khổng lồ WordPress pluginorPHPMailerversions that have enhancedsecurity features or bugs.

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

khổng lồ fix the error, first thing is to vì is khổng lồ identify the cause for the error, by checking & 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 ‘mail.domain.com’. 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 to 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 khổng lồ SMTP server and port is working fine, use the command:

telnet domain.com 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: Cách Tải Video Trên Google Chrome Đơn Giản Nhất, Cách Tải Video Trên Chrome Đơn Giản Nhất

2. SMTP authentication details

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

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

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

If the authentication details given are wrong, WordPresswill fail to send mails và give the error ‘SMTP connect() failed‘.

3. SMTP encryption settings

For secure e-mail transmission, it is always advisable to 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 thư điện tử server. Also,verify the SSL certificate for your mail server, using the command:

openssl s_client -starttls smtp -crlf -connect mail.domain.com:25 Using expired or self-signed certificates can cause the mail delivery using SSL khổng lồ fail & give error ‘SMTP connect() failed‘.

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

4. Support for 3rd party apps

Gmail servers have a lot of security restrictions in place, which may cause them khổng lồ block attempts from certain mail client apps.

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


*

Allow less secure apps in email account


If you are using tin nhắn 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 to stop using ‘WP Mail SMTP’ plugin & 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 lớn SMTP host.’

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

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

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

hotlive |

Hi88