Body: <p>I’m looking for some assistance to debug an issue with the Cividesk Sparkpost extension.  At first I thought that the extension was not compatible with Civi 5.8.x, but others report that is not the case.  I am using the latest Cividesk code from github.  Here are the symptoms.  </p>
  
  <ul>
  <li><p>The extension installed without an error, and when I entered the API key from Sparkpost and clicked “Save and send test email” it delivers an email with the content “Your SparkPost settings are correct.”  The API key is authorized for all functions.</p></li>
  <li><p>In Civicrm, emails are going out, but they are NOT going out through
  Sparkpost.</p></li>
  <li><p>Since we have a backup email method defined, Civimail will send
  everything out through the backup method – in this case a
  self-managed SMTP server that is not ideal (for reasons I won’t go
  into here).  Civimail shows the email as started and completed
  successfully.</p></li>
  <li><p>Civicrm transactional emails are also delivered successfully through
  the backup SMTP method.</p></li>
  <li><p>The ConfigAndLog/sparkpost_log file contains the following:</p></li>
  </ul>
  
  <blockquote>
    <p>==== ERROR in CRM_Sparkpost::call() ==== stdClass Object (
        [errors] => Array
            (
                [0] => stdClass Object
                    (
                        [message] => Forbidden.
                    )
            ) )</p>
  </blockquote>
  
  <ul>
  <li>If we disable the backup SMTP, no emails are delivered.  Civicrm pops
  up this error message:</li>
  </ul>
  
  <blockquote>
    <p>Sparkpost error: Permission denied. Check that the API key is
    authorized for request
    <a href="https://api.sparkpost.com/api/v1/suppression-list/recipient@example.com" rel="nofollow noreferrer">https://api.sparkpost.com/api/v1/suppression-list/recipient@example.com</a>.</p>
  </blockquote>
  
  <ul>
  <li><p>Also in this case, all of the contact emails are set “on hold”.</p></li>
  <li><p>As for potential causes, it is possible that recent changes to the
  server DNS may have created a problem.  I am not that familiar with
  DNS, but new records were added for DKIM, DMARC and SPF and I am
  wondering if we got it wrong.  The above errors coincide with the DNS
  changes, but that may have nothing to do with it.</p></li>
  <li><p>I don’t understand how the test email says the settings are correct
  but otherwise we are seeing permission errors.  The API key and other
  settings have been checked many times.</p></li>
  <li><p>This is on Wordpress 5.0.3, Civi 5.9.0 (upgraded today, with no
  effect on the issue), and PHP 7.1.  If you want to see the DNS
  records, check <a href="https://mxtoolbox.com/SuperTool.aspx?action=dns%3Athehcpac.org&amp;run=toolpage" rel="nofollow noreferrer">here</a>.</p></li>
  </ul>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-01-16T08:02:16.907Z
Comments.Text: Are you in the US or the EU?
Comments.UserDisplayName: Tony Horrocks
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-01-16T17:59:17.117Z
Comments.Text: The US.  Should that matter?
Comments.UserDisplayName: twowheeler
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-01-17T12:13:45.953Z
Comments.Text: Yes it does, because if you are in the EU there is a different Sparkpost domain to register for GDPR reasons. So you need to fiddle with the code a bit. Anyways you don't need to do that. I would double check everything at the Sparkpost end particularly if you have exceeded the hourly quota or something like that.
Comments.UserDisplayName: Tony Horrocks
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-01-21T01:04:08.853Z
Comments.Text: To close this issue, I eventually gave up on the cividesk extension and removed it.  Instead I set up Sparkpost using the regular SMTP process and created a bounce account for it.  It seems to work just fine.
Comments.UserDisplayName: twowheeler
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-04-12T10:16:36.873Z
Comments.Text: @TonyHorrocks could you elaborate on the 'fiddling' needed (or link to somewhere with details)? I think I'm hitting that brick wall - am on smtp.eu.sparkpost.com and getting API invalid.
Comments.UserDisplayName: John Bradford
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2019-04-15T13:14:06.667Z
Comments.Text: Yes. In the extension files go to CRM/sparkpost.php and alter line 85 to read 
  
      curl_setopt($ch, CURLOPT_URL, "https://api.eu.sparkpost.com/api/v1/$path");
Comments.UserDisplayName: Tony Horrocks
Tags: <civimail><sparkpost>
Title: Permission errors on Cividesk Sparkpost extension
ThreadText: # Permission errors on Cividesk Sparkpost extension
  
  (Asked by: username_0 on 2019-01-14)
  
  I’m looking for some assistance to debug an issue with the Cividesk Sparkpost extension. At first I thought that the extension was not compatible with Civi 5.8.x, but others report that is not the case. I am using the latest Cividesk code from github. Here are the symptoms.
  
  * The extension installed without an error, and when I entered the API key from Sparkpost and clicked “Save and send test email” it delivers an email with the content “Your SparkPost settings are correct.” The API key is authorized for all functions.
  * In Civicrm, emails are going out, but they are NOT going out through
    Sparkpost.
  * Since we have a backup email method defined, Civimail will send
    everything out through the backup method – in this case a
    self-managed SMTP server that is not ideal (for reasons I won’t go
    into here). Civimail shows the email as started and completed
    successfully.
  * Civicrm transactional emails are also delivered successfully through
    the backup SMTP method.
  * The ConfigAndLog/sparkpost\_log file contains the following:
  
  > ==== ERROR in CRM\_Sparkpost::call() ==== stdClass Object (
  > [errors] => Array
  > (
  > [0] => stdClass Object
  > (
  > [message] => Forbidden.
  > )
  > ) )
  
  * If we disable the backup SMTP, no emails are delivered. Civicrm pops
    up this error message:
  
  > Sparkpost error: Permission denied. Check that the API key is
  > authorized for request
  > <https://api.sparkpost.com/api/v1/suppression-list/recipient@example.com>.
  
  * Also in this case, all of the contact emails are set “on hold”.
  * As for potential causes, it is possible that recent changes to the
    server DNS may have created a problem. I am not that familiar with
    DNS, but new records were added for DKIM, DMARC and SPF and I am
    wondering if we got it wrong. The above errors coincide with the DNS
    changes, but that may have nothing to do with it.
  * I don’t understand how the test email says the settings are correct
    but otherwise we are seeing permission errors. The API key and other
    settings have been checked many times.
  * This is on Wordpress 5.0.3, Civi 5.9.0 (upgraded today, with no
    effect on the issue), and PHP 7.1. If you want to see the DNS
    records, check [here](https://mxtoolbox.com/SuperTool.aspx?action=dns%3Athehcpac.org&run=toolpage).
  
  **Tags:** civimail, sparkpost
  
  > **Comments:**
  > **username_1**: Are you in the US or the EU?  
  > **username_0**: The US.  Should that matter?  
  > **username_1**: Yes it does, because if you are in the EU there is a different Sparkpost domain to register for GDPR reasons. So you need to fiddle with the code a bit. Anyways you don't need to do that. I would double check everything at the Sparkpost end particularly if you have exceeded the hourly quota or something like that.  
  > **username_0**: To close this issue, I eventually gave up on the cividesk extension and removed it.  Instead I set up Sparkpost using the regular SMTP process and created a bounce account for it.  It seems to work just fine.  
  > **username_2**: @username_1 could you elaborate on the 'fiddling' needed (or link to somewhere with details)? I think I'm hitting that brick wall - am on smtp.eu.sparkpost.com and getting API invalid.  
  > **username_1**: Yes. In the extension files go to CRM/sparkpost.php and alter line 85 to read       curl_setopt($ch, CURLOPT_URL, "https://api.eu.sparkpost.com/api/v1/$path");  
  
  ---
  
  ## 0 answers
  
  