Answers.Body: <p>I experienced this problem when I was running different versions of PHP in the website and my command line interface (CLI).  You can check your PHP version for the web at <strong>Administer menu » Administration Console » System Status</strong>.  You can find your CLI PHP version by running <code>php -v</code>.  I was running 7.0 and 7.2 respectively.</p>
  
  <p>Since PHP 7.2 has deprecated the <code>php-mcrypt</code> module, CiviCRM was expecting my mail password to be unencrypted when run from CLI, and encrypted when run from the web interface.  So all web-based testing works - but CLI gets authentication errors.  The solution is to match your PHP version on web and CLI.</p>
  
  <p>Note that if you move from some lower version to PHP 7.2+, you'll need to re-enter your mail password for things to work.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-26T08:53:57.480Z
Answers.Text: Yup, that was the problem. I've upgraded my site to 7.2 - now both Apache2 and CLI are using that and the mailing executes correctly.
Answers.UserDisplayName: roland
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-05T07:20:30.933Z
Answers.Text: This was also our problem, thank you!
Answers.UserDisplayName: Robin Fenwick
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-14T17:13:38.927Z
Answers.Text: I've recently upgraded to PHP 7.2 and am running into this (web-based testing works including running cron from web link, but not cron/scheduled jobs via CLI). Both CLI and web are now on PHP 7.2 and I've resaved my SMTP settings, but still have this issue. Is there another step?
Answers.UserDisplayName: Laryn
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-14T18:19:21.840Z
Answers.Text: @Laryn-CEDC.org Is it possible that the `mcrypt` extension is being loaded via web SAPI but not CLI, or vice versa?  If you look in `civicrm_settings` do you see the password saved as plaintext or encrypted?
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-14T19:29:59.590Z
Answers.Text: @JonG-MegaphoneTech It is encrypted in the database. I will have a server tech make sure the extension is loaded for CLI. Thanks.
Answers.UserDisplayName: Laryn
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-02-25T20:00:38.370Z
Answers.LastActivityDate: 2019-02-25T20:00:38.370Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>I have some issues with sending out mailings (used to work, now it doesn't anymore). My mailing is failing 100% with a combination of the following errors:</p>
  
  <ol>
  <li><code>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 &gt;&gt; Global Settings &gt;&gt; Outbound Ema</code></li>
  <li><code>Failed to set sender: b.1139.33843.cb2d344bc94b0533@myserver.com [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 Admi</code></li>
  </ol>
  
  <p>Regarding the <code>Administer CiviCRM &gt;&gt; Global Settings &gt;&gt; Outbound Ema</code> settings, I have checked these copious times and have verified that they work using the "Save &amp; Send Test Email" function. This for both the <code>mail()</code> and <code>SMTP</code> settings.</p>
  
  <p>I have also tested the actual mailing settings by sending a test to one of my email addresses. This works 100% - which would indicate that the mailing test function uses a different approach to the actual mailing component (this does not make sense for me as it will result in inconsistent results).</p>
  
  <p>Now more to the actual errors:</p>
  
  <ol>
  <li>No idea what's wrong, as the tests pass. </li>
  <li>I thought this was a part of the VERP option (server changes the email address) - the SMTP does not recognise the email address and does not allow sending.</li>
  </ol>
  
  <p>When using <code>mail()</code>, the mailing is successfully sent, but most of the emails fall into the very dark hole of the internet - and the ones that get delivered are mostly sent to spam. This is because the reverse DNS look up for my domain is not the same as the IP of my server.</p>
  
  <p>When using <code>SMTP</code> the SMTP server does not recognise the email address I am sending from. And yes, I have switched off the VERP function (I think).</p>
  
  <p>Any ideas what else I can do to get closer to fixing this?</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-02-25T19:05:37.087Z
Comments.Text: I'm seeing something similar.  What version of CiviCRM are you using?
Comments.UserDisplayName: Jon G - Megaphone Tech
Tags: <wordpress><error><mailing><smtp>
Title: Mailing Bounces 100% with "authentication failure" or "failed to set sender"
ThreadText: # Mailing Bounces 100% with "authentication failure" or "failed to set sender"
  
  (Asked by: username_0 on 2019-02-22)
  
  I have some issues with sending out mailings (used to work, now it doesn't anymore). My mailing is failing 100% with a combination of the following errors:
  
  1. `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 Ema`
  2. `Failed to set sender: b.1139.33843.cb2d344bc94b0533@myserver.com [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 Admi`
  
  Regarding the `Administer CiviCRM >> Global Settings >> Outbound Ema` settings, I have checked these copious times and have verified that they work using the "Save & Send Test Email" function. This for both the `mail()` and `SMTP` settings.
  
  I have also tested the actual mailing settings by sending a test to one of my email addresses. This works 100% - which would indicate that the mailing test function uses a different approach to the actual mailing component (this does not make sense for me as it will result in inconsistent results).
  
  Now more to the actual errors:
  
  1. No idea what's wrong, as the tests pass.
  2. I thought this was a part of the VERP option (server changes the email address) - the SMTP does not recognise the email address and does not allow sending.
  
  When using `mail()`, the mailing is successfully sent, but most of the emails fall into the very dark hole of the internet - and the ones that get delivered are mostly sent to spam. This is because the reverse DNS look up for my domain is not the same as the IP of my server.
  
  When using `SMTP` the SMTP server does not recognise the email address I am sending from. And yes, I have switched off the VERP function (I think).
  
  Any ideas what else I can do to get closer to fixing this?
  
  **Tags:** wordpress, error, mailing, smtp
  
  > **Comments:**
  > **username_1**: I'm seeing something similar.  What version of CiviCRM are you using?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-02-25. Score: 5 | Accepted answer
  
  I experienced this problem when I was running different versions of PHP in the website and my command line interface (CLI). You can check your PHP version for the web at **Administer menu » Administration Console » System Status**. You can find your CLI PHP version by running `php -v`. I was running 7.0 and 7.2 respectively.
  
  Since PHP 7.2 has deprecated the `php-mcrypt` module, CiviCRM was expecting my mail password to be unencrypted when run from CLI, and encrypted when run from the web interface. So all web-based testing works - but CLI gets authentication errors. The solution is to match your PHP version on web and CLI.
  
  Note that if you move from some lower version to PHP 7.2+, you'll need to re-enter your mail password for things to work.
  
  > **Comments:**
  > **username_0**: Yup, that was the problem. I've upgraded my site to 7.2 - now both Apache2 and CLI are using that and the mailing executes correctly.  
  > **username_2**: This was also our problem, thank you!  
  > **username_3**: I've recently upgraded to PHP 7.2 and am running into this (web-based testing works including running cron from web link, but not cron/scheduled jobs via CLI). Both CLI and web are now on PHP 7.2 and I've resaved my SMTP settings, but still have this issue. Is there another step?  
  > **username_1**: @username_3-CEDC.org Is it possible that the `mcrypt` extension is being loaded via web SAPI but not CLI, or vice versa?  If you look in `civicrm_settings` do you see the password saved as plaintext or encrypted?  
  > **username_3**: @JonG-MegaphoneTech It is encrypted in the database. I will have a server tech make sure the extension is loaded for CLI. Thanks.  
  
  ---
  
  