SparkPost Mail Transport

SparkPost Mail Transport 1.1.0

No permission to download
Hello, can i get some ideas how to fix such type of error
Code:
SparkPost\SparkPostException: Job Hampel\SparkPostMail:MessageEvent: {"errors":[{"param":"from","message":"from must be before to","value":"2020-08-06T06:36:00"}]} src/addons/Hampel/SparkPostMail/vendor/sparkpost/sparkpost/lib/SparkPost/SparkPostPromise.php:77
Code:
#0 src/addons/Hampel/SparkPostMail/SubContainer/SparkPost.php(61): SparkPost\SparkPostPromise->wait()
#1 src/addons/Hampel/SparkPostMail/Job/MessageEvent.php(41): Hampel\SparkPostMail\SubContainer\SparkPost->getMessageEvents(1, 1000, Array, 1596695806, 1596695808)
#2 src/XF/Job/Manager.php(253): Hampel\SparkPostMail\Job\MessageEvent->run(G)
#3 src/XF/Job/Manager.php(195): XF\Job\Manager->runJobInternal(Array, G)
#4 src/XF/Job/Manager.php(79): XF\Job\Manager->runJobEntry(Array, G)
#5 job.php(42): XF\Job\Manager->runQueue(false, 8)
#6 {main}

-------------

Previous GuzzleHttp\Exception\ClientException: Client error: `GET https://api.sparkpost.com/api/v1/events/message?page=1&per_page=1000&events=bounce,policy_rejection,out_of_band,generation_rejection,spam_complaint,list_unsubscribe,link_unsubscribe&from=2020-08-06T06%3A36&to=2020-08-06T06%3A36` resulted in a `400 Bad Request` response:
{"errors":[{"param":"from","message":"from must be before to","value":"2020-08-06T06:36:00"}]}
 - src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113
#0 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/guzzle/src/Middleware.php(65): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response))
#1 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/promises/src/Promise.php(203): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Response))
#2 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/promises/src/Promise.php(156): GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), Array)
#3 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/promises/src/TaskQueue.php(47): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise\{closure}()
#4 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php(119): GuzzleHttp\Promise\TaskQueue->run()
#5 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php(146): GuzzleHttp\Handler\CurlMultiHandler->tick()
#6 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/promises/src/Promise.php(246): GuzzleHttp\Handler\CurlMultiHandler->execute(true)
#7 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/promises/src/Promise.php(223): GuzzleHttp\Promise\Promise->invokeWaitFn()
#8 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/promises/src/Promise.php(267): GuzzleHttp\Promise\Promise->waitIfPending()
#9 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/promises/src/Promise.php(225): GuzzleHttp\Promise\Promise->invokeWaitList()
#10 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/promises/src/Promise.php(62): GuzzleHttp\Promise\Promise->waitIfPending()
#11 src/addons/Hampel/SparkPostMail/vendor/php-http/guzzle6-adapter/src/Promise.php(95): GuzzleHttp\Promise\Promise->wait(false)
#12 src/addons/Hampel/SparkPostMail/vendor/sparkpost/sparkpost/lib/SparkPost/SparkPostPromise.php(73): Http\Adapter\Guzzle6\Promise->wait(true)
#13 src/addons/Hampel/SparkPostMail/SubContainer/SparkPost.php(61): SparkPost\SparkPostPromise->wait()
#14 src/addons/Hampel/SparkPostMail/Job/MessageEvent.php(41): Hampel\SparkPostMail\SubContainer\SparkPost->getMessageEvents(1, 1000, Array, 1596695806, 1596695808)
#15 src/XF/Job/Manager.php(253): Hampel\SparkPostMail\Job\MessageEvent->run(G)
#16 src/XF/Job/Manager.php(195): XF\Job\Manager->runJobInternal(Array, G)
#17 src/XF/Job/Manager.php(79): XF\Job\Manager->runJobEntry(Array, G)
#18 job.php(42): XF\Job\Manager->runQueue(false, 8)
#19 {main}
Thank you! Regards
 
Did it only happen once, or has there been multiple occurrences?

I looked through the code and it would be very unusual for this to happen - but I can see how it might.

I will add some sanity checks to prevent such an error happening again.

Either way, unless it is happening frequently, it shouldn't cause any ongoing issues.
 
Did it only happen once, or has there been multiple occurrences?

I looked through the code and it would be very unusual for this to happen - but I can see how it might.

I will add some sanity checks to prevent such an error happening again.

Either way, unless it is happening frequently, it shouldn't cause any ongoing issues.
It happened only once (for now), thank you for your time. Regards
 
  • Like
Reactions: Sim
v1.x of this addon is not compatible with XF 2.2

A new version which is compatible will be released shortly
 
Sim updated SparkPost Mail Transport with a new update entry:

v1.1.0 critical update

This update makes important changes to prepare sites for upgrade to XenForo v2.2

Important: before upgrading your forum to XF v2.2, make sure you are running v1.1.0 of this addon, then immediately after upgrading to XF v2.2, upgrade this addon to v2.0 - available here: https://xenforo.com/community/resources/sparkpost-mail-transport-for-xf-2-2.7990/

Changes in v1.1.0:
  • rename apikey parameter in preparation for XF 2.2 upgrade and addon v2.x
  • put in checks to...

Read the rest of this update entry...
 
@Sim

We love your add-on! Thanks for sharing your tweak with us. One question. SparkPost Mail Transport hasn't been updated since Sept 2020. Are updates planned for 2021 and 2022?
 
@Sim

We love your add-on! Thanks for sharing your tweak with us. One question. SparkPost Mail Transport hasn't been updated since Sept 2020. Are updates planned for 2021 and 2022?

I run this addon in production across 8 XenForo forums.

It will be updated as necessary for bug fixes and functionality changes if anything changes in either XenForo or SparkPost to affect its operation.

So, no - there are no updates "planned", but the addon is receiving ongoing support and will be updated if required.
 
hello @Sim
great addon, we use it in production too and it does the job wonderfully well.

The server error log is, however, cluttered with warning messages:

1633227080949.png

  • SparkPost\SparkPostException: Job Hampel\SparkPostMail:MessageEvent: {"errors": [ {"message": "Resource could not be found"} ] }
  • src/addons/Hampel/SparkPostMail/vendor/sparkpost/sparkpost/lib/SparkPost/SparkPostPromise.php:77
  • Generated by: Unknown account
  • Oct 3, 2021 at 9:51 AM

Stack trace​

#0 src/addons/Hampel/SparkPostMail/SubContainer/SparkPost.php(82): SparkPost\SparkPostPromise->wait()
#1 src/addons/Hampel/SparkPostMail/Job/MessageEvent.php(50): Hampel\SparkPostMail\SubContainer\SparkPost->getUri('/api/v1/events/...')
#2 src/XF/Job/Manager.php(260): Hampel\SparkPostMail\Job\MessageEvent->run(8)
#3 src/XF/Job/Manager.php(202): XF\Job\Manager->runJobInternal(Array, 8)
#4 src/XF/Job/Manager.php(86): XF\Job\Manager->runJobEntry(Array, 8)
#5 src/XF/Cli/Command/RunJobs.php(59): XF\Job\Manager->runQueue(false, 8)
#6 src/vendor/symfony/console/Command/Command.php(255): XF\Cli\Command\RunJobs->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 src/vendor/symfony/console/Application.php(992): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 src/vendor/symfony/console/Application.php(255): Symfony\Component\Console\Application->doRunCommand(Object(XF\Cli\Command\RunJobs), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 src/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 src/XF/Cli/Runner.php(111): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 cmd.php(15): XF\Cli\Runner->run()
#12 {main}

-------------

Previous GuzzleHttp\Exception\ClientException: Client error: GET https://api.sparkpost.com/api/v1//api/v1/events/message?cursor=MTYzMjUyMDE0MzAwMCw3MDExMTQ2Mjg4MDg5MzcyNjYy&page=1&per_page=1000&events=bounce,policy_rejection,out_of_band,generation_rejection,spam_complaint,list_unsubscribe,link_unsubscribe&from=2021-09-22T01:51:00&to=2021-10-03T01:51:00 resulted in a 404 Not Found response:
{"errors": [ {"message": "Resource could not be found"} ] }

- src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113
#0 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/guzzle/src/Middleware.php(65): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response))
#1 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/promises/src/Promise.php(204): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Response))
#2 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/promises/src/Promise.php(153): GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), NULL)
#3 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/promises/src/TaskQueue.php(48): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise\{closure}()
#4 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php(118): GuzzleHttp\Promise\TaskQueue->run()
#5 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/guzzle/src/Handler/CurlMultiHandler.php(145): GuzzleHttp\Handler\CurlMultiHandler->tick()
#6 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/promises/src/Promise.php(248): GuzzleHttp\Handler\CurlMultiHandler->execute(true)
#7 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/promises/src/Promise.php(224): GuzzleHttp\Promise\Promise->invokeWaitFn()
#8 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/promises/src/Promise.php(269): GuzzleHttp\Promise\Promise->waitIfPending()
#9 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/promises/src/Promise.php(226): GuzzleHttp\Promise\Promise->invokeWaitList()
#10 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/promises/src/Promise.php(62): GuzzleHttp\Promise\Promise->waitIfPending()
#11 src/addons/Hampel/SparkPostMail/vendor/php-http/guzzle6-adapter/src/Promise.php(94): GuzzleHttp\Promise\Promise->wait(false)
#12 src/addons/Hampel/SparkPostMail/vendor/sparkpost/sparkpost/lib/SparkPost/SparkPostPromise.php(73): Http\Adapter\Guzzle6\Promise->wait(true)
#13 src/addons/Hampel/SparkPostMail/SubContainer/SparkPost.php(82): SparkPost\SparkPostPromise->wait()
#14 src/addons/Hampel/SparkPostMail/Job/MessageEvent.php(50): Hampel\SparkPostMail\SubContainer\SparkPost->getUri('/api/v1/events/...')
#15 src/XF/Job/Manager.php(260): Hampel\SparkPostMail\Job\MessageEvent->run(8)
#16 src/XF/Job/Manager.php(202): XF\Job\Manager->runJobInternal(Array, 8)
#17 src/XF/Job/Manager.php(86): XF\Job\Manager->runJobEntry(Array, 8)
#18 src/XF/Cli/Command/RunJobs.php(59): XF\Job\Manager->runQueue(false, 8)
#19 src/vendor/symfony/console/Command/Command.php(255): XF\Cli\Command\RunJobs->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 src/vendor/symfony/console/Application.php(992): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 src/vendor/symfony/console/Application.php(255): Symfony\Component\Console\Application->doRunCommand(Object(XF\Cli\Command\RunJobs), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 src/vendor/symfony/console/Application.php(148): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 src/XF/Cli/Runner.php(111): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 cmd.php(15): XF\Cli\Runner->run()
#25 {main}

Any thoughts on a fix or suppressing these errors?

We are running XF 2.2 (latest version) and with the latest version of the add on too:
1633227191040.png

1633227204627.png

1633227231886.png

EDIT: sorry, I realize I posted on the wrong thread. I'm using the 2.1.0 https://xenforo.com/community/threads/sparkpost-mail-transport-for-xf-2-2.184846/
I'll keep the post here if this helps anyone else
 
Any updates to this add-on? I am getting this error:
  • GuzzleHttp\Exception\ClientException: Email to admin@xxx.com from aahadden1993@gmail.com failed: Client error: POST https://api.sparkpost.com/api/v1/transmissions resulted in a 400 Bad Request response: {"errors":[{"message":"Unconfigured Sending Domain <gmail.com>","code":"7001"}]}
  • src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113
  • Generated by: Unknown account
  • Feb 18, 2024 at 9:27 AM

Stack trace​

#0 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/guzzle/src/Middleware.php(65): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response))
#1 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/promises/src/Promise.php(204): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Response))
#2 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/promises/src/Promise.php(153): GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), NULL)
#3 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/promises/src/TaskQueue.php(48): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise\{closure}()
#4 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/promises/src/Promise.php(248): GuzzleHttp\Promise\TaskQueue->run(true)
#5 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/promises/src/Promise.php(224): GuzzleHttp\Promise\Promise->invokeWaitFn()
#6 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/promises/src/Promise.php(269): GuzzleHttp\Promise\Promise->waitIfPending()
#7 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/promises/src/Promise.php(226): GuzzleHttp\Promise\Promise->invokeWaitList()
#8 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/promises/src/Promise.php(62): GuzzleHttp\Promise\Promise->waitIfPending()
#9 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/guzzle/src/Client.php(182): GuzzleHttp\Promise\Promise->wait()
#10 src/addons/Hampel/SparkPostMail/vendor/hampel/swiftmailer-sparkpost/src/Transport/SparkPostTransport.php(65): GuzzleHttp\Client->request('POST', 'https://api.spa...', Array)
#11 src/XF/Mail/Mailer.php(315): Hampel\SparkPostDriver\Transport\SparkPostTransport->send(Object(Hampel\SparkPostDriver\Message), NULL)
#12 src/XF/Mail/Queue.php(148): XF\Mail\Mailer->send(Object(Hampel\SparkPostDriver\Message), Object(Hampel\SparkPostDriver\Transport\SparkPostTransport), Array)
#13 src/XF/Job/MailQueue.php(12): XF\Mail\Queue->run(7.98336)
#14 src/XF/Job/Manager.php(260): XF\Job\MailQueue->run(7.98336)
#15 src/XF/Job/Manager.php(202): XF\Job\Manager->runJobInternal(Array, 7.98336)
#16 src/XF/Job/Manager.php(86): XF\Job\Manager->runJobEntry(Array, 7.98336)
#17 job.php(43): XF\Job\Manager->runQueue(false, 8)
#18 {main}
 
Any updates to this add-on? I am getting this error:
  • GuzzleHttp\Exception\ClientException: Email to admin@xxx.com from aahadden1993@gmail.com failed: Client error: POST https://api.sparkpost.com/api/v1/transmissions resulted in a 400 Bad Request response: {"errors":[{"message":"Unconfigured Sending Domain <gmail.com>","code":"7001"}]}
  • src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113
  • Generated by: Unknown account
  • Feb 18, 2024 at 9:27 AM

Stack trace​

#0 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/guzzle/src/Middleware.php(65): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response))
#1 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/promises/src/Promise.php(204): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Response))
#2 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/promises/src/Promise.php(153): GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), NULL)
#3 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/promises/src/TaskQueue.php(48): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise\{closure}()
#4 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/promises/src/Promise.php(248): GuzzleHttp\Promise\TaskQueue->run(true)
#5 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/promises/src/Promise.php(224): GuzzleHttp\Promise\Promise->invokeWaitFn()
#6 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/promises/src/Promise.php(269): GuzzleHttp\Promise\Promise->waitIfPending()
#7 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/promises/src/Promise.php(226): GuzzleHttp\Promise\Promise->invokeWaitList()
#8 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/promises/src/Promise.php(62): GuzzleHttp\Promise\Promise->waitIfPending()
#9 src/addons/Hampel/SparkPostMail/vendor/guzzlehttp/guzzle/src/Client.php(182): GuzzleHttp\Promise\Promise->wait()
#10 src/addons/Hampel/SparkPostMail/vendor/hampel/swiftmailer-sparkpost/src/Transport/SparkPostTransport.php(65): GuzzleHttp\Client->request('POST', 'https://api.spa...', Array)
#11 src/XF/Mail/Mailer.php(315): Hampel\SparkPostDriver\Transport\SparkPostTransport->send(Object(Hampel\SparkPostDriver\Message), NULL)
#12 src/XF/Mail/Queue.php(148): XF\Mail\Mailer->send(Object(Hampel\SparkPostDriver\Message), Object(Hampel\SparkPostDriver\Transport\SparkPostTransport), Array)
#13 src/XF/Job/MailQueue.php(12): XF\Mail\Queue->run(7.98336)
#14 src/XF/Job/Manager.php(260): XF\Job\MailQueue->run(7.98336)
#15 src/XF/Job/Manager.php(202): XF\Job\Manager->runJobInternal(Array, 7.98336)
#16 src/XF/Job/Manager.php(86): XF\Job\Manager->runJobEntry(Array, 7.98336)
#17 job.php(43): XF\Job\Manager->runQueue(false, 8)
#18 {main}

What version of XenForo are you running? This addon v1.x is not compatible with XF 2.2

Also, the error indicates that you don't have sparkpost configured correctly - you are trying to send email from a gmail.com address, which is not possible - you must have your own domain configured as the sending address.
 
Back
Top Bottom