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 (  => 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://firstname.lastname@example.org.
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.