Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot send test email #62

Open
mattwire opened this issue Jul 25, 2018 · 29 comments
Open

Cannot send test email #62

mattwire opened this issue Jul 25, 2018 · 29 comments

Comments

@mattwire
Copy link

mattwire commented Jul 25, 2018

This commit 85a4a89 breaks sending test emails for me. I didn't test whether it also breaks sending other email but I'm guessing it does.

When pressing "Save and Send Test Email" from: Administer->System Settings->Outbound Email (Sparkpost)

I get the following error:

Sending test email. FROM: XXX@XXX TO: YYY@YYY.
Oops. Your SparkPost settings are incorrect. No test mail has been sent.
An error occurred when CiviCRM attempted to send an email (via SMTP). If you received this error after submitting on online contribution or event registration - the transaction was completed, but we were unable to send the email receipt.

The mail library returned the following error message:
Sparkpost error: HTTP return code 405, Sparkpost error code 1102 (invalid http method: PUT is not supported on /api/v1/transmissions). Check https://support.sparkpost.com/customer/en/portal/articles/2140916-extended-error-codes for interpretation.

This is probably related to a problem in your Outbound Email Settings (Administer CiviCRM » System Settings » Outbound Email), OR the FROM email address specifically configured for your contribution page or event. Possible causes are:

Your Sendmail path is incorrect.
Your Sendmail argument is incorrect.
The FROM Email Address configured for this feature may not be a valid sender based on your email service provider rules.
@mattwire
Copy link
Author

Tagging @sunilpawar

@sunilpawar
Copy link

@mattwire can you confirm the sending domain (from email address)?

@mattwire
Copy link
Author

@sunilpawar Sorry :-) FROM and TO are both valid email addresses - I replaced them with XXX and YYY for this ticket.

@sunilpawar
Copy link

@mattwire its working on our environment
PHP : 5.6.35
cURL : 7.53.1
Can you confirm it by reverting these changes?

@mattwire
Copy link
Author

@sunilpawar Sure, everything works perfectly with the previous commit: b5b04fb

I've tested on:

  • Joomla with PHP 7.0.30 (curl 7.29)
  • Drupal with PHP 7.0.30-2 (curl 7.60)

Both have the same issue.

@sunilpawar
Copy link

@nganivet look like curl re-use connection not working with php 7. lets discus this.

@nganivet
Copy link
Contributor

@mattwire Thanks for reporting. Can you try adding curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); just before line 113 of CRM/Sparkpost.php and test to see if it fixes your issue?

@nganivet
Copy link
Contributor

@mattwire Might need 'GET' instead of 'POST' in the above, not quite sure as the documentation is lacking. Can you try both and report back here? Thanks.

@mattwire
Copy link
Author

@nganivet I replaced the existing line:
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
with
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");

and that seems to fix the problem. Note that I tested with POST and that failed with a message 404 on creating webhook when trying to send a test email.

@nganivet
Copy link
Contributor

@mattwire OK, we will fix the issue and release a new version. Thanks for your feedback.

@nganivet
Copy link
Contributor

@mattwire Can you please test the latest commit and confirm it works on your side. Was a bit difficult to fix cleanly as documentation on CURLOPT_CUSTOMREQUEST is lacking and this is what caused the issue.

@laryn
Copy link
Contributor

laryn commented Jul 30, 2018

Using the latest dev it was not working and seemed to match what @mattwire describes here:

Note that I tested with POST and that failed with a message 404 on creating webhook when trying to send a test email.

I used the latest official release and patched the line suggested here and then the test email is reported as sending correctly (although I haven't received it yet).

@mattwire
Copy link
Author

With this fix I get

SparkPost error
Could not install webhook (Sparkpost error: HTTP return code 404, Sparkpost error code (Resource could not be found: ). Check https://support.sparkpost.com/customer/en/portal/articles/2140916-extended-error-codes for interpretation.).

But changing line 44 to curl_setopt(self::$ch, CURLOPT_CUSTOMREQUEST, "GET"); per the original suggestion makes it work.

mattwire added a commit to mattwire/com.cividesk.email.sparkpost that referenced this issue Jul 30, 2018
@lsmithgo
Copy link

why is this issue closed when it clearly is still an issue and the 1.2 version does not work?

@nganivet nganivet reopened this Jul 30, 2018
@mattwire
Copy link
Author

@lsmithgo github automatically closes them when you reference an issue in a commit message

@mattwire
Copy link
Author

@nganivet @sunilpawar So the original one-liner suggestion curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET"); seems to work, but the actual changes and my subsequent PR #63 don't work - nothing actually gets received by Sparkpost.

@sunilpawar
Copy link

@mattwire
@nganivet I have upgraded our development server to php 7.0.30
PHP 7.0.30
Curl : 7.40.0
Tested on Drupal (7.59), CiviCRM (4.7.31)

I changed CURLOPT_CUSTOMREQUEST value and sent test mail. Following are the result for different value.
CURLOPT_CUSTOMREQUEST: NULL => Pass
CURLOPT_CUSTOMREQUEST: 'GET' => Pass
CURLOPT_CUSTOMREQUEST: 'POST' => Pass
CURLOPT_CUSTOMREQUEST: 'PUT' => Fail

For Failed Result, following is the message.
Sparkpost error: HTTP return code 405, Sparkpost error code 1102 (invalid http method: PUT is not supported on /api/v1/transmissions). Check https://support.sparkpost.com/customer/en/portal/articles/2140916-extended-error-codes for interpretation.

(branch: master with latest changes).

@sunilpawar
Copy link

@mattwire have you faced issue with web-hook ? its again related php 7.* with recent changes on CURLOPT_CUSTOMREQUEST

@mattwire
Copy link
Author

mattwire commented Aug 9, 2018

@sunilpawar I didn't try the web-hook as I switched back to an older version on live sites until the issue with CUSTOMREQUEST is fully resolved.

@andyburnsco
Copy link

Same issue here, I tried the same fix that Matt tried but nothing happens. I revered back to ver 1.1.

@robbrandt
Copy link

I am getting the same error as @mattwire after I upgraded to CiviCRM 5.4.1 and v1.2 of this extension. I am using php 5.6.37 on Ubuntu 16.04.

@robbrandt
Copy link

Interestingly, just after I posted this comment I got a delayed receipt from our CiviCRM installation. I tried a test transaction first, didn't get a receipt immediately, then went to the sparkpost configuration to test it. I believe it is working OK on production tasks, but throwing this error only during the "test" function.

@andyburnsco
Copy link

andyburnsco commented Aug 29, 2018

capture

So I see that using ver 1.1 with Civi 5.4.0 prevents any jquery from working :(

@rick02840
Copy link

Drupal 7.60, Civi 5.3.2, PHP 5.6.36, getting same error as others (below).
Was there a recommended solution for this?
Thanks.

The mail library returned the following error message:
Sparkpost error: HTTP return code 405, Sparkpost error code 1102 (invalid http method: PUT is not supported on /api/v1/transmissions). Check https://support.sparkpost.com/customer/en/portal/articles/2140916-extended-error-codes for interpretation.

This is probably related to a problem in your Outbound Email Settings (Administer CiviCRM » System Settings » Outbound Email), OR the FROM email address specifically configured for your contribution page or event. Possible causes are:

Your Sendmail path is incorrect.
Your Sendmail argument is incorrect.
The FROM Email Address configured for this feature may not be a valid sender based on your email service provider rules.
Check this page for more information

@mattwire
Copy link
Author

@rick02840 I use the extension based on this commit: b5b04fb
Just before all the CURL changes went in that broke things. That version works fine on all my sites.

@rick02840
Copy link

rick02840 commented Oct 30, 2018

Thanks I think that fixed it! The test email working now here: /civicrm/admin/setting/sparkpost?reset=1 ...will see if membership reminder emails start flowing again.
So I guess the update to 1.2 broke it.
Thank you so much for responding!

@rick02840
Copy link

rick02840 commented Oct 31, 2018

Not sure if mail sending is working yet, but I am still seeing these errors below in Drupal logs (/admin/reports/dblog):

TYPE	civicrm
DATE	Tuesday, October 30, 2018 - 8:28pm
USER	civimail
LOCATION	https://myorganization.org/civicrm-cron/passthrough?key=302d240d8d732a72806a5e7da0f3b5da
REFERRER	
MESSAGE	$backTrace = #0 /home/webserver/myorganization.org/profiles/cm_starterkit_moderate/modules/civicrm/CRM/Core/Error.php(339): CRM_Core_Error::backtrace("backTrace", TRUE) #1 /home/webserver/myorganization.org/profiles/cm_starterkit_moderate/modules/civicrm/CRM/Utils/Mail/EmailProcessor.php(175): CRM_Core_Error::fatal("Could not connect to MailStore for @smtp.sparkpostmail.com<p>Error message: <...") #2 /home/webserver/myorganization.org/profiles/cm_starterkit_moderate/modules/civicrm/CRM/Utils/Mail/EmailProcessor.php(59): CRM_Utils_Mail_EmailProcessor::_process(TRUE, Object(CRM_Core_DAO_MailSettings), 0) #3 /home/webserver/myorganization.org/profiles/cm_starterkit_moderate/modules/civicrm/api/v3/Job.php(368): CRM_Utils_Mail_EmailProcessor::processBounces(0) #4 /home/webserver/myorganization.org/profiles/cm_starterkit_moderate/modules/civicrm/Civi/API/Provider/MagicFunctionProvider.php(89): civicrm_api3_job_fetch_bounces((Array:2)) #5 /home/webserver/myorganization.org/profiles/cm_starterkit_moderate/modules/civicrm/Civi/API/Kernel.php(169): Civi\API\Provider\MagicFunctionProvider->invoke((Array:9)) #6 /home/webserver/myorganization.org/profiles/cm_starterkit_moderate/modules/civicrm/Civi/API/Kernel.php(100): Civi\API\Kernel->runRequest((Array:7)) #7 /home/webserver/myorganization.org/profiles/cm_starterkit_moderate/modules/civicrm/api/api.php(23): Civi\API\Kernel->runSafe("Job", "fetch_bounces", (Array:1), NULL) #8 /home/webserver/myorganization.org/profiles/cm_starterkit_moderate/modules/civicrm/CRM/Core/JobManager.php(145): civicrm_api("Job", "fetch_bounces", (Array:1)) #9 /home/webserver/myorganization.org/profiles/cm_starterkit_moderate/modules/civicrm/CRM/Core/JobManager.php(79): CRM_Core_JobManager->executeJob(Object(CRM_Core_ScheduledJob)) #10 /home/webserver/myorganization.org/profiles/cm_starterkit_moderate/modules/contrib/civicrm_cron/civicrm_cron.module(165): CRM_Core_JobManager->execute() #11 [internal function](): civicrm_cron_passthrough() #12 /home/webserver/myorganization.org/includes/menu.inc(527): call_user_func_array("civicrm_cron_passthrough", (Array:0)) #13 /home/webserver/myorganization.org/index.php(21): menu_execute_active_handler() #14 {main}
SEVERITY	debug
HOSTNAME	00.000.000.00
OPERATIONS	


TYPE	civicrm
DATE	Tuesday, October 30, 2018 - 8:28pm
USER	civimail
LOCATION	https://myorganization.org/civicrm-cron/passthrough?key=302d240d8d732a72806a5e7da0f3b5da
REFERRER	
MESSAGE	$Fatal Error Details = Array ( [message] => Could not connect to MailStore for @smtp.sparkpostmail.com<p>Error message: <pre>An error occured while sending or receiving mail. Failed to connect to the server: smtp.sparkpostmail.com:993.</pre><p> [code] => )
SEVERITY	debug
HOSTNAME	00.000.000.00
OPERATIONS	

UPDATE:
I may have settings wrong here: /civicrm/admin/mailSettings?reset=1
There was no username or pass.
If I understand this correctly: https://app.sparkpost.com/account/smtp
username should be: SMTP_Injection
password should be: my sparkpost API key
I put that in, will see what happens.

UPDATE:
Nope, still seeing errors above, hourly on corn run.

@sunilpawar
Copy link

@mattwire @rick02840
Can you try these changes on top of v1.2

I have Tested this on our dev environment and its working for us. If this work for you, then i will push these changes to repository.

Additional Details:
PHP 7.0.30
curl : 7.40.0
Drupa: 7.59, CiviCRM: 4.7.31

@cdhassell
Copy link

That patch still doesn't work for me. I can only make v1.2 work by backing out the curl optimizations commit as others have reported here.

php 7.0.32
wordpress 4.9.8
civicrm 5.5.3
curl 7.35.0

mlutfy pushed a commit to coopsymbiotic/sparkpost that referenced this issue Dec 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants