Answers.Body: <p>I had this very same problem with SMTP and couldn't find a solution with the configuration, although I didn't change the code you mention.
  I found a workaround by choosing mail() instead of SMTP in Administer>system settings>outbound email, since when I've had no problems.  The default option should apparently work fine on linux systems, if that is appropriate.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-21T13:23:19.647Z
Answers.Text: Yes, I can send mails with the mail() function but I wan't to use a specific smtp server. So unfortunately this is no option.
Answers.UserDisplayName: Philipp Michael
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-21T12:51:15.443Z
Answers.LastActivityDate: 2016-12-21T12:51:15.443Z
Answers.UserDisplayName: peterb
Body: <p>After upgrading CiviCRM from 4.6 to 4.7.14 I was not able to send (test) emails via SMTP. I got the following error:</p>
  
  <blockquote>
    <p>authentication failure [SMTP: STARTTLS failed (code: 220, response: 2.0.0 Ready to start TLS)]</p>
  </blockquote>
  
  <p>After replacing some code in <code>/packages/Net/SMTP.php</code> like <a href="https://civicrm.stackexchange.com/a/10981/123">Matt</a> suggested I'm now receiving the error:</p>
  
  <blockquote>
    <p>authentication failure [SMTP: Invalid response code received from SMTP server while sending email. This is often caused by a misconfiguration in Outbound Email settings. Please verify the settings at Administer CiviCRM >> Global Settings >> Outbound Email (SMTP). (code: 535, response: 5.7.8 Error: authentication failed: authentication failure)]</p>
  </blockquote>
  
  <p>Maillog says:</p>
  
  <blockquote>
    <p>Dec 21 11:19:55 rs0815 postfix/smtpd[31606]: warning: SASL authentication failure: client response doesn't match what we generated
    Dec 21 11:19:55 rs0815 postfix/smtpd[31606]: warning: rs0815.rs.example.de[123.123.123.123]: SASL DIGEST-MD5 authentication failed: authentication failure</p>
  </blockquote>
  
  <p>I doesn't make a difference if I use PHP 5.5 or 5.6.</p>
  
  <p>Any idea what could cause this?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-12-20T21:21:49.123Z
Comments.Text: Can you provide more information?  E.g. are you prefixing your outgoing mail address with "ssl://"?  In Civi 4.7 you should remove that since it's technically incorrect; see https://github.com/civicrm/civicrm-packages/pull/66
Comments.UserDisplayName: Jon G - Megaphone Tech
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-12-21T07:59:46.110Z
Comments.Text: The SMTP-server is not prefixed with "ssl://", besides it is suggested in the input help: "If the server uses SSL, add 'ssl://' to the beginning of the server name[...]". It's just like smtp.example.com and port 25 with an authentication.
Comments.UserDisplayName: Philipp Michael
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-12-21T10:24:24.457Z
Comments.Text: I've checked the log, see my updated question.
Comments.UserDisplayName: Philipp Michael
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-01-22T11:38:29.433Z
Comments.Text: Hi Philipp, are you also the administrator of the SMTP server. The log suggests it is postfix. Maybe the post http://unix.stackexchange.com/questions/204515/postfix-with-smtp-authentication-failing offers some help. But it involves altering the configuration of postfix.
Comments.UserDisplayName: Kainuk - CiviCooP
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-02-10T11:54:04.723Z
Comments.Text: It's now working, but I don't know why. I didn't do anything conscious. So I'm still interested in a solution of this problem.
Comments.UserDisplayName: Philipp Michael
Tags: <civimail><mailserver>
Title: How to resolve SMTP connection failing problem with code 535?
ThreadText: # How to resolve SMTP connection failing problem with code 535?
  
  (Asked by: username_0 on 2016-12-20)
  
  After upgrading CiviCRM from 4.6 to 4.7.14 I was not able to send (test) emails via SMTP. I got the following error:
  
  > authentication failure [SMTP: STARTTLS failed (code: 220, response: 2.0.0 Ready to start TLS)]
  
  After replacing some code in `/packages/Net/SMTP.php` like [Matt](https://civicrm.stackexchange.com/a/10981/123) suggested I'm now receiving the error:
  
  > authentication failure [SMTP: Invalid response code received from SMTP server while sending email. This is often caused by a misconfiguration in Outbound Email settings. Please verify the settings at Administer CiviCRM >> Global Settings >> Outbound Email (SMTP). (code: 535, response: 5.7.8 Error: authentication failed: authentication failure)]
  
  Maillog says:
  
  > Dec 21 11:19:55 rs0815 postfix/smtpd[31606]: warning: SASL authentication failure: client response doesn't match what we generated
  > Dec 21 11:19:55 rs0815 postfix/smtpd[31606]: warning: rs0815.rs.example.de[123.123.123.123]: SASL DIGEST-MD5 authentication failed: authentication failure
  
  I doesn't make a difference if I use PHP 5.5 or 5.6.
  
  Any idea what could cause this?
  
  **Tags:** civimail, mailserver
  
  > **Comments:**
  > **username_1**: Can you provide more information?  E.g. are you prefixing your outgoing mail address with "ssl://"?  In Civi 4.7 you should remove that since it's technically incorrect; see https://github.com/civicrm/civicrm-packages/pull/66  
  > **username_0**: The SMTP-server is not prefixed with "ssl://", besides it is suggested in the input help: "If the server uses SSL, add 'ssl://' to the beginning of the server name[...]". It's just like smtp.example.com and port 25 with an authentication.  
  > **username_0**: I've checked the log, see my updated question.  
  > **username_2**: Hi Philipp, are you also the administrator of the SMTP server. The log suggests it is postfix. Maybe the post http://unix.stackexchange.com/questions/204515/postfix-with-smtp-authentication-failing offers some help. But it involves altering the configuration of postfix.  
  > **username_0**: It's now working, but I don't know why. I didn't do anything conscious. So I'm still interested in a solution of this problem.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_3 on 2016-12-21. Score: 0
  
  I had this very same problem with SMTP and couldn't find a solution with the configuration, although I didn't change the code you mention.
  I found a workaround by choosing mail() instead of SMTP in Administer>system settings>outbound email, since when I've had no problems. The default option should apparently work fine on linux systems, if that is appropriate.
  
  > **Comments:**
  > **username_0**: Yes, I can send mails with the mail() function but I wan't to use a specific smtp server. So unfortunately this is no option.  
  
  ---
  
  