“SMTP Error: Could not connect to SMTP host.” error message
-
Hi,
I’m trying to set up SendGrid smtp but it doesn’t connect to SendGrid. I’ve checked my SendGrid info and everything is correct.I’m using TLS with port 587. I’m using the same settings in Outlook and Gmail and I’m able to send emails fine through SendGrid.
-
Can you please share all of your SMTP settings (except username and password, of course), and all the debugging output that you see when sending a Test email to a valid email address?
-
This reply was modified 7 years, 4 months ago by
Slava Abakumov.
Hi Slava,
Here’s the debugging output (user and pw removed):Test Message Sent The result was: bool(false) The full debugging output is shown below: PHPMailer Object ( [Version] => 5.2.22 [Priority] => [CharSet] => UTF-8 [ContentType] => text/plain [Encoding] => 7bit [ErrorInfo] => SMTP Error: Could not connect to SMTP host. [From] => [email protected] [FromName] => Website Notification [Sender] => [email protected] [ReturnPath] => [Subject] => WP Mail SMTP: Test mail to [email protected] [Body] => This is a test email generated by the WP Mail SMTP WordPress plugin. [AltBody] => [Ical] => [MIMEBody:protected] => This is a test email generated by the WP Mail SMTP WordPress plugin. [MIMEHeader:protected] => Date: Fri, 3 Nov 2017 13:50:58 +0000 To: [email protected] From: Website Notification Subject: WP Mail SMTP: Test mail to [email protected] Message-ID: X-Mailer: PHPMailer 5.2.22 (https://github.com/PHPMailer/PHPMailer) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 [mailHeader:protected] => [WordWrap] => 0 [Mailer] => smtp [Sendmail] => /usr/sbin/sendmail [UseSendmailOptions] => 1 [PluginDir] => [ConfirmReadingTo] => [Hostname] => [MessageID] => [MessageDate] => Fri, 3 Nov 2017 13:50:58 +0000 [Host] => smtp.sendgrid.net [Port] => 587 [Helo] => [SMTPSecure] => tls [SMTPAutoTLS] => 1 [SMTPAuth] => 1 [SMTPOptions] => Array ( ) [Username] => ****** [Password] => ***** [AuthType] => [Realm] => [Workstation] => [Timeout] => 300 [SMTPDebug] => 0 [Debugoutput] => echo [SMTPKeepAlive] => [SingleTo] => [SingleToArray] => Array ( ) [do_verp] => [AllowEmpty] => [LE] => [DKIM_selector] => [DKIM_identity] => [DKIM_passphrase] => [DKIM_domain] => [DKIM_private] => [DKIM_private_string] => [action_function] => [XMailer] => [smtp:protected] => SMTP Object ( [Version] => 5.2.22 [SMTP_PORT] => 25 [CRLF] => [do_debug] => 0 [Debugoutput] => echo [do_verp] => [Timeout] => 300 [Timelimit] => 300 [smtp_transaction_id_patterns:protected] => Array ( [exim] => /[0-9]{3} OK id=(.*)/ [sendmail] => /[0-9]{3} 2.0.0 (.*) Message/ [postfix] => /[0-9]{3} 2.0.0 Ok: queued as (.*)/ ) [smtp_conn:protected] => [error:protected] => Array ( [error] => [detail] => [smtp_code] => [smtp_code_ex] => ) [helo_rply:protected] => [server_caps:protected] => [last_reply:protected] => 221 drone.hosterbox.com closing connection ) [to:protected] => Array ( [0] => Array ( [0] => [email protected] [1] => ) ) [cc:protected] => Array ( ) [bcc:protected] => Array ( ) [ReplyTo:protected] => Array ( ) [all_recipients:protected] => Array ( [[email protected]] => 1 ) [RecipientsQueue:protected] => Array ( ) [ReplyToQueue:protected] => Array ( ) [attachment:protected] => Array ( ) [CustomHeader:protected] => Array ( ) [lastMessageID:protected] => [message_type:protected] => plain [boundary:protected] => Array ( [1] => b1_a0486c8292ed73d2f28e201c1c96acef [2] => b2_a0486c8292ed73d2f28e201c1c96acef [3] => b3_a0486c8292ed73d2f28e201c1c96acef ) [language:protected] => Array ( [authenticate] => SMTP Error: Could not authenticate. [connect_host] => SMTP Error: Could not connect to SMTP host. [data_not_accepted] => SMTP Error: data not accepted. [empty_message] => Message body empty [encoding] => Unknown encoding: [execute] => Could not execute: [file_access] => Could not access file: [file_open] => File Error: Could not open file: [from_failed] => The following From address failed: [instantiate] => Could not instantiate mail function. [invalid_address] => Invalid address: [mailer_not_supported] => mailer is not supported. [provide_address] => You must provide at least one recipient email address. [recipients_failed] => SMTP Error: The following recipients failed: [signing] => Signing Error: [smtp_connect_failed] => SMTP connect() failed. [smtp_error] => SMTP server error: [variable_set] => Cannot set or reset variable: [extension_missing] => Extension missing: ) [error_count:protected] => 2 [sign_cert_file:protected] => [sign_key_file:protected] => [sign_extracerts_file:protected] => [sign_key_pass:protected] => [exceptions:protected] => 1 [uniqueid:protected] => a0486c8292ed73d2f28e201c1c96acef ) The SMTP debugging output is shown below:
Btw, I’m using sendgrid on my own site, with port 465 and SSL encryption, username is
apikey
and password is the key you get from settings.So try to change the settings as I wrote above.
I tried those settings but still getting an error ??
Test Message Sent The result was: bool(false) The full debugging output is shown below: PHPMailer Object ( [Version] => 5.2.22 [Priority] => [CharSet] => UTF-8 [ContentType] => text/plain [Encoding] => 7bit [ErrorInfo] => SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting [From] => [email protected] [FromName] => Website Notification [Sender] => [email protected] [ReturnPath] => [Subject] => WP Mail SMTP: Test mail to [email protected] [Body] => This is a test email generated by the WP Mail SMTP WordPress plugin. [AltBody] => [Ical] => [MIMEBody:protected] => This is a test email generated by the WP Mail SMTP WordPress plugin. [MIMEHeader:protected] => Date: Fri, 3 Nov 2017 18:14:11 +0000 To: [email protected] From: Website Notification Subject: WP Mail SMTP: Test mail to [email protected] Message-ID: <[email protected]> X-Mailer: PHPMailer 5.2.22 (https://github.com/PHPMailer/PHPMailer) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 [mailHeader:protected] => [WordWrap] => 0 [Mailer] => smtp [Sendmail] => /usr/sbin/sendmail [UseSendmailOptions] => 1 [PluginDir] => [ConfirmReadingTo] => [Hostname] => [MessageID] => [MessageDate] => Fri, 3 Nov 2017 18:14:11 +0000 [Host] => smtp.sendgrid.net [Port] => 465 [Helo] => [SMTPSecure] => ssl [SMTPAutoTLS] => 1 [SMTPAuth] => 1 [SMTPOptions] => Array ( ) [Username] => apikey [Password] => ******** [AuthType] => [Realm] => [Workstation] => [Timeout] => 300 [SMTPDebug] => 0 [Debugoutput] => echo [SMTPKeepAlive] => [SingleTo] => [SingleToArray] => Array ( ) [do_verp] => [AllowEmpty] => [LE] => [DKIM_selector] => [DKIM_identity] => [DKIM_passphrase] => [DKIM_domain] => [DKIM_private] => [DKIM_private_string] => [action_function] => [XMailer] => [smtp:protected] => SMTP Object ( [Version] => 5.2.22 [SMTP_PORT] => 25 [CRLF] => [do_debug] => 0 [Debugoutput] => echo [do_verp] => [Timeout] => 300 [Timelimit] => 300 [smtp_transaction_id_patterns:protected] => Array ( [exim] => /[0-9]{3} OK id=(.*)/ [sendmail] => /[0-9]{3} 2.0.0 (.*) Message/ [postfix] => /[0-9]{3} 2.0.0 Ok: queued as (.*)/ ) [smtp_conn:protected] => [error:protected] => Array ( [error] => [detail] => [smtp_code] => [smtp_code_ex] => ) [helo_rply:protected] => [server_caps:protected] => [last_reply:protected] => ) [to:protected] => Array ( [0] => Array ( [0] => [email protected] [1] => ) ) [cc:protected] => Array ( ) [bcc:protected] => Array ( ) [ReplyTo:protected] => Array ( ) [all_recipients:protected] => Array ( [[email protected]] => 1 ) [RecipientsQueue:protected] => Array ( ) [ReplyToQueue:protected] => Array ( ) [attachment:protected] => Array ( ) [CustomHeader:protected] => Array ( ) [lastMessageID:protected] => <[email protected]> [message_type:protected] => plain [boundary:protected] => Array ( [1] => b1_83a3c3875c51e7b1a96ac4b554e1769b [2] => b2_83a3c3875c51e7b1a96ac4b554e1769b [3] => b3_83a3c3875c51e7b1a96ac4b554e1769b ) [language:protected] => Array ( [authenticate] => SMTP Error: Could not authenticate. [connect_host] => SMTP Error: Could not connect to SMTP host. [data_not_accepted] => SMTP Error: data not accepted. [empty_message] => Message body empty [encoding] => Unknown encoding: [execute] => Could not execute: [file_access] => Could not access file: [file_open] => File Error: Could not open file: [from_failed] => The following From address failed: [instantiate] => Could not instantiate mail function. [invalid_address] => Invalid address: [mailer_not_supported] => mailer is not supported. [provide_address] => You must provide at least one recipient email address. [recipients_failed] => SMTP Error: The following recipients failed: [signing] => Signing Error: [smtp_connect_failed] => SMTP connect() failed. [smtp_error] => SMTP server error: [variable_set] => Cannot set or reset variable: [extension_missing] => Extension missing: ) [error_count:protected] => 2 [sign_cert_file:protected] => [sign_key_file:protected] => [sign_extracerts_file:protected] => [sign_key_pass:protected] => [exceptions:protected] => 1 [uniqueid:protected] => 83a3c3875c51e7b1a96ac4b554e1769b )
Now it’s another error.
Previously it wasSMTP Error: Could not connect to SMTP host.
, and nowSMTP connect() failed.
Please read the docs here: https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting#smtp-error-could-not-connect-to-smtp-host
In short, you will need to contact your hosting company.
Kaiwen: I fixed my Gmail problem by enabling “access for less secure apps” in my Google account. Never had to do this before the plugin was updated. Hope this helps someone else.
-
This reply was modified 7 years, 4 months ago by
- The topic ‘“SMTP Error: Could not connect to SMTP host.” error message’ is closed to new replies.