Answers.Body: <p>From what I understand, this can be because the server you contact has a self-signed certificate (see <a href="https://civicrm.stackexchange.com/questions/10964/smtp-connection-failing-problem">this question</a> for a workaround), or because the PEAR SMTP package version used by CiviCRM does not support TLS. <a href="https://github.com/civicrm/civicrm-packages/blob/4.7.15-rc/VERSIONS.php" rel="nofollow noreferrer">Civi uses 1.6.1</a>, but <a href="https://pear.php.net/package/Net_SMTP/download/1.7.1" rel="nofollow noreferrer">support was added in 1.7.1</a>.</p>
  
  <p>In our case (php7, CiviCRM 4.7), we are able to work around this by forcing SSL connection rather than TLS. In the Outbound mail settings
  1) put <code>ssl://</code> in front of the mail server name
  2) change the port to something appropriate. Usually to 465**</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-10-29T14:03:52.133Z
Answers.Text: +1 self signed. I created a certificate for my server from LetsEncrypt changed the server name in CiviCRM from `localhost` to `my.real-server-name.com` and it was happy. CiviCRM 5.3.1 PHP 7.0
Answers.UserDisplayName: artfulrobot
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-01-12T08:19:50.117Z
Answers.LastActivityDate: 2017-03-22T16:02:11.417Z
Answers.LastEditDate: 2017-04-13T12:53:13.167Z
Answers.UserDisplayName: Djizeus
Answers.Body: <p>Same error with CiviCRM 4.7.4, Drupal :</p>
  
  <blockquote>
    <p>authentication failure [SMTP: STARTTLS failed (code: 220, response: 2.0.0 continue)].</p>
  </blockquote>
  
  <p>Using mail() allows us to send mails, but with the local SMTP server.</p>
  
  <p>Downgrading to PHP5.5 resolves this problem. With PHP5.6 the problem is in packages/Net/SMTP.php when calling <code>$this-&gt;_socket-&gt;enableCrypto()</code></p>
  
  <p>This is due to php 5.6 : <a href="https://civicrm.stackexchange.com/a/10966">https://civicrm.stackexchange.com/a/10966</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-05T22:56:34.203Z
Answers.Text: Using php 5.5 resolve this problem. With Php5.6 the problem is in packages/Net/SMTP.php when calling $this->_socket->enableCrypto( ...
Answers.UserDisplayName: olivier
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-06T05:00:04.203Z
Answers.Text: can you add your comment as part of the answer to make it more like an answer ;-)
Answers.UserDisplayName: petednz - fuzion
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-06T08:08:53.060Z
Answers.Text: I'd be interested if you can expand your answer Olivier, or create an issue with details over on https://issues.civicrm.org
Answers.UserDisplayName: Chris Burgess
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-06T08:12:27.233Z
Answers.Text: PHP5.6 changed the defaults for cert verification (http://php.net/manual/en/migration56.openssl.php) but I'm not sure that sounds like what you describe; it would explain the breakage being linked to v5.6 though ... See also [CRM-14814](https://issues.civicrm.org/jira/browse/CRM-14814) and [CRM-8744](https://issues.civicrm.org/jira/browse/CRM-8744).
Answers.UserDisplayName: Chris Burgess
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-06T20:13:27.613Z
Answers.Text: Not tested yet : http://civicrm.stackexchange.com/a/10966
Answers.UserDisplayName: olivier
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-12T18:08:43.897Z
Answers.Text: So is this specifically a php 5.6 issue on civi 4.7.X or is this an issue with php 5.6 that will also cause problems on an LTS version of civi (4.6.x)?
Answers.UserDisplayName: Jose Torres
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-14T19:49:01.320Z
Answers.Text: I'm a WordPress user and had the same problem olivier described, trying to upgrade to CiviCRM 4.7.8. I had to downgrade to PHP 5.5. Will this be fixed in a future version of CiviCRM or are we forever stuck on PHP 5.5? Thanks for everyone's efforts!
Answers.UserDisplayName: jimcrist
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-04-05T22:26:53.857Z
Answers.LastActivityDate: 2016-04-06T20:11:20.327Z
Answers.LastEditDate: 2017-04-13T12:53:13.167Z
Answers.UserDisplayName: olivier
Answers.Body: <p>Seems there is some work in progress to attach this on <a href="https://issues.civicrm.org/jira/browse/CRM-18408" rel="nofollow noreferrer">CRM-18408
  SMTP connection via SSL and TLS in PHP 5.6</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-05-19T20:27:24.073Z
Answers.LastActivityDate: 2017-05-19T20:27:24.073Z
Answers.UserDisplayName: Francesc Bassas i Bullich
Body: <p>I recently upgraded my site to 4.7.1.  Outbound SMTP does not work.  Even though I use the correct credentials, I get errors and email does not send.  I restored my site back to 4.6, and all is good.</p>
  
  <p>Tried testing on your sandbox, but 4.7 is not available yet.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-02-08T09:49:34.620Z
Comments.Text: What error do you get? could you put the detail in your question? And can you clarify if the error happens both for transactional emails and civimail? As the availability of the demo/sandbox for 4.7: sending emails is disabled there, so it won't help sorting out your problem
Comments.UserDisplayName: Xavier
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-02-29T19:40:31.857Z
Comments.Text: I also have problems since 4.7.1 with SMTP. It seems that my provider wants authentication without TLS, but there seems to be no way to configure that. The summary of the "test" is as follows:
  
  With SSL and using port 465 I get the message: "Failed to connect to ssl://smtp.mail-ch.ch:465 [SMTP: Failed to connect socket: Connection timed out (code: -1, response: )]".
  
  Without SSL and using port 587, I get: "authentication failure [SMTP: STARTTLS failed (code: 220, response: 2.0.0 Ready to start TLS)]".
  
  Wordpress is the newest, civicrm v4.7.1, and it's running under PHP v5.6.
  
  Is V4.7.2 a fix?
Comments.UserDisplayName: David Christie
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-04-07T13:34:43.167Z
Comments.Text: An answer I posted [here](http://civicrm.stackexchange.com/questions/10964/smtp-connection-failing-problem) has been linked to this question. However I doubt that these two questions are duplicates as this one is due to CiviCRM upgrade and the other is due to server package update. Unless php is also updated in this scenario, it is better to keep this question here. Otherwise we should mark this duplicated after the action in this [answer](http://civicrm.stackexchange.com/a/10966) is approved by core team.
Comments.UserDisplayName: Guanhuan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-04-12T12:30:11.963Z
Comments.Text: My hosting provider, Civihosting, moved us from PHP 5.5 to PHP 5.6 on 4/11 and this morning one of our folks ran into what seems like the same problem with civimcil. When sending a test of an unscheduled mailing, he receives the error: Error in call to Mailing_send_test: STARTLLS failed So this looks like the issue is the PHP version. When we have more info, we will post it.
Comments.UserDisplayName: Rick Cunningham
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-08-09T01:53:15.800Z
Comments.Text: Confirmed with Civi 4.7.10 on Joomla 3.6.2 on PHP 5.6. Rolled back to PHP 5.5.38 and SMTP works again. This is a qualified bug.
Comments.UserDisplayName: BruceW
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-11-15T22:26:59.107Z
Comments.Text: @BruceW Is there a ticket open on JIRA for this?
Comments.UserDisplayName: David Hayes
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-01-12T17:00:50.153Z
Comments.Text: I have also been experiencing an SMTP problem similar to this with SparkPost on WordPress CiviCRM 4.7.12. It had all been working great before the upgrade. Then it wouldn't send any emails I went in the SMTP configuration and on a whim changed the port from 587 to 2525. Then they mostly started sending except a handful that bounced in Civi with a syntax bounce (didn't make it to SparkPost). This is what Civi recorded as the bounce reason: authentication failure [SMTP: STARTTLS failed (code: 220, response: 2.0.0 continue)] I tried the ssl:// suggestion, but it didn't work with SparkPost.
Comments.UserDisplayName: Philip Eoute
Tags: <smtp>
Title: Outbound mail fails after upgrading to 4.7.1
ThreadText: # Outbound mail fails after upgrading to 4.7.1
  
  (Asked by: username_0 on 2016-02-08)
  
  I recently upgraded my site to 4.7.1. Outbound SMTP does not work. Even though I use the correct credentials, I get errors and email does not send. I restored my site back to 4.6, and all is good.
  
  Tried testing on your sandbox, but 4.7 is not available yet.
  
  **Tags:** smtp
  
  > **Comments:**
  > **username_1**: What error do you get? could you put the detail in your question? And can you clarify if the error happens both for transactional emails and civimail? As the availability of the demo/sandbox for 4.7: sending emails is disabled there, so it won't help sorting out your problem  
  > **username_2**: I also have problems since 4.7.1 with SMTP. It seems that my provider wants authentication without TLS, but there seems to be no way to configure that. The summary of the "test" is as follows:  With SSL and using port 465 I get the message: "Failed to connect to ssl://smtp.mail-ch.ch:465 [SMTP: Failed to connect socket: Connection timed out (code: -1, response: )]".  Without SSL and using port 587, I get: "authentication failure [SMTP: STARTTLS failed (code: 220, response: 2.0.0 Ready to start TLS)]".  Wordpress is the newest, civicrm v4.7.1, and it's running under PHP v5.6.  Is V4.7.2 a fix?  
  > **username_3**: An answer I posted [here](http://civicrm.stackexchange.com/questions/10964/smtp-connection-failing-problem) has been linked to this question. However I doubt that these two questions are duplicates as this one is due to CiviCRM upgrade and the other is due to server package update. Unless php is also updated in this scenario, it is better to keep this question here. Otherwise we should mark this duplicated after the action in this [answer](http://civicrm.stackexchange.com/a/10966) is approved by core team.  
  > **username_4**: My hosting provider, Civihosting, moved us from PHP 5.5 to PHP 5.6 on 4/11 and this morning one of our folks ran into what seems like the same problem with civimcil. When sending a test of an unscheduled mailing, he receives the error: Error in call to Mailing_send_test: STARTLLS failed So this looks like the issue is the PHP version. When we have more info, we will post it.  
  > **username_5**: Confirmed with Civi 4.7.10 on Joomla 3.6.2 on PHP 5.6. Rolled back to PHP 5.5.38 and SMTP works again. This is a qualified bug.  
  > **username_6**: @username_5 Is there a ticket open on JIRA for this?  
  > **username_7**: I have also been experiencing an SMTP problem similar to this with SparkPost on WordPress CiviCRM 4.7.12. It had all been working great before the upgrade. Then it wouldn't send any emails I went in the SMTP configuration and on a whim changed the port from 587 to 2525. Then they mostly started sending except a handful that bounced in Civi with a syntax bounce (didn't make it to SparkPost). This is what Civi recorded as the bounce reason: authentication failure [SMTP: STARTTLS failed (code: 220, response: 2.0.0 continue)] I tried the ssl:// suggestion, but it didn't work with SparkPost.  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_8 on 2017-01-12. Score: 6
  
  From what I understand, this can be because the server you contact has a self-signed certificate (see [this question](https://civicrm.stackexchange.com/questions/10964/smtp-connection-failing-problem) for a workaround), or because the PEAR SMTP package version used by CiviCRM does not support TLS. [Civi uses 1.6.1](https://github.com/civicrm/civicrm-packages/blob/4.7.15-rc/VERSIONS.php), but [support was added in 1.7.1](https://pear.php.net/package/Net_SMTP/download/1.7.1).
  
  In our case (php7, CiviCRM 4.7), we are able to work around this by forcing SSL connection rather than TLS. In the Outbound mail settings
  1) put `ssl://` in front of the mail server name
  2) change the port to something appropriate. Usually to 465\*\*
  
  > **Comments:**
  > **username_9**: +1 self signed. I created a certificate for my server from LetsEncrypt changed the server name in CiviCRM from `localhost` to `my.real-server-name.com` and it was happy. CiviCRM 5.3.1 PHP 7.0  
  
  ---
  
  ### Answer by username_10 on 2016-04-05. Score: 2
  
  Same error with CiviCRM 4.7.4, Drupal :
  
  > authentication failure [SMTP: STARTTLS failed (code: 220, response: 2.0.0 continue)].
  
  Using mail() allows us to send mails, but with the local SMTP server.
  
  Downgrading to PHP5.5 resolves this problem. With PHP5.6 the problem is in packages/Net/SMTP.php when calling `$this->_socket->enableCrypto()`
  
  This is due to php 5.6 : <https://civicrm.stackexchange.com/a/10966>
  
  > **Comments:**
  > **username_10**: Using php 5.5 resolve this problem. With Php5.6 the problem is in packages/Net/SMTP.php when calling $this->_socket->enableCrypto( ...  
  > **username_11**: can you add your comment as part of the answer to make it more like an answer ;-)  
  > **username_12**: I'd be interested if you can expand your answer username_10, or create an issue with details over on https://issues.civicrm.org  
  > **username_12**: PHP5.6 changed the defaults for cert verification (http://php.net/manual/en/migration56.openssl.php) but I'm not sure that sounds like what you describe; it would explain the breakage being linked to v5.6 though ... See also [CRM-14814](https://issues.civicrm.org/jira/browse/CRM-14814) and [CRM-8744](https://issues.civicrm.org/jira/browse/CRM-8744).  
  > **username_10**: Not tested yet : http://civicrm.stackexchange.com/a/10966  
  > **username_13**: So is this specifically a php 5.6 issue on civi 4.7.X or is this an issue with php 5.6 that will also cause problems on an LTS version of civi (4.6.x)?  
  > **username_14**: I'm a WordPress user and had the same problem username_10 described, trying to upgrade to CiviCRM 4.7.8. I had to downgrade to PHP 5.5. Will this be fixed in a future version of CiviCRM or are we forever stuck on PHP 5.5? Thanks for everyone's efforts!  
  
  ---
  
  ### Answer by username_15 on 2017-05-19. Score: 0
  
  Seems there is some work in progress to attach this on [CRM-18408
  SMTP connection via SSL and TLS in PHP 5.6](https://issues.civicrm.org/jira/browse/CRM-18408)
  
  
  ---
  
  