SparkPost Mail Transport for XF 2.2

SparkPost Mail Transport for XF 2.2 2.1.4

No permission to download
From the addons description:
This addon has full bounced email and unsubscribed email handling support using the SparkPost Events API - no mailbox required.

So I don't need to fill-up or enable these options?
1655156222853.webp
 
How about?
View attachment 269577

Any random word@sending-sub-domain?
Or a blank option is fine?

Can't be blank - this will be set as the From address in the mail header. Domain must match one of your sending domains in SparkPost.

You should expect people to reply to this address - even if you have explicitly asked them not to as per the default mail templates.

I use webmaster@mysite.com for my sites ... xenforo.com uses contact@xenforo.com

It's common for people to use noreply@ or similar if you don't want to deal with replies - but best practice is to have a real mail address so you can process complaints appropriately.
 
  • Like
Reactions: rdn
@Sim
Any idea why my user registration email validations send so delayed? It takes a good like 3-5 minutes whereas when I send a test outbound mail on ACP>tools it goes instant.

It's keeping me from launching my website since validation emails are critical for my project. If you can help (if fee is needed I can do that) please do!

DKIM, SPF, etc are all showing good on SparkPost's end.
 
@Sim
Any idea why my user registration email validations send so delayed? It takes a good like 3-5 minutes whereas when I send a test outbound mail on ACP>tools it goes instant.

It's keeping me from launching my website since validation emails are critical for my project. If you can help (if fee is needed I can do that) please do!

DKIM, SPF, etc are all showing good on SparkPost's end.

Is this a new website with very little traffic on it?

Are you using the "Activity based trigger" for jobs or the "Server based trigger"?

Search for jobRunTrigger in the admin options.

For a new site with not much traffic, it can take some time for the activity based trigger to send emails - whereas the server based trigger runs externally via a cron task and so isn't affected by traffic or a lack thereof.
 
Is this a new website with very little traffic on it?

Are you using the "Activity based trigger" for jobs or the "Server based trigger"?

Search for jobRunTrigger in the admin options.

For a new site with not much traffic, it can take some time for the activity based trigger to send emails - whereas the server based trigger runs externally via a cron task and so isn't affected by traffic or a lack thereof.
Ah, this is interesting! I will try to set it to server based trigger since yes it is a new website
 
Is this a new website with very little traffic on it?

Are you using the "Activity based trigger" for jobs or the "Server based trigger"?

Search for jobRunTrigger in the admin options.

For a new site with not much traffic, it can take some time for the activity based trigger to send emails - whereas the server based trigger runs externally via a cron task and so isn't affected by traffic or a lack thereof.
Any idea why my cronjob from the addon is failing? Error below.
I'm pretty sure I got my API key inserted right.

Code:
Server error log
[LIST]
[*]SparkPost\SparkPostException: Job Hampel\SparkPostMail:MessageEvent: {"errors":[{"param":"from","message":"from must be before to","value":"2022-08-29T07:52:00"}]}
[*]src/addons/Hampel/SparkPostMail/vendor/sparkpost/sparkpost/lib/SparkPost/SparkPostPromise.php:77
[*]Generated by: Unknown account
[*]Aug 29, 2022 at 8:52 AM
[/LIST]
[HEADING=2]Stack trace[/HEADING]
#0 src/addons/Hampel/SparkPostMail/SubContainer/SparkPost.php(76): SparkPost\SparkPostPromise->wait()
#1 src/addons/Hampel/SparkPostMail/Job/MessageEvent.php(50): Hampel\SparkPostMail\SubContainer\SparkPost->getMessageEvents(1, 1000, Array, 1661759543, 1661759544)
#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 job.php(43): 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=2022-08-29T07%3A52&to=2022-08-29T07%3A52` resulted in a `400 Bad Request` response:
{"errors":[{"param":"from","message":"from must be before to","value":"2022-08-29T07:52: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(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(76): SparkPost\SparkPostPromise->wait()
#14 src/addons/Hampel/SparkPostMail/Job/MessageEvent.php(50): Hampel\SparkPostMail\SubContainer\SparkPost->getMessageEvents(1, 1000, Array, 1661759543, 1661759544)
#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 job.php(43): XF\Job\Manager->runQueue(false, 8)
#19 {main}
[HEADING=2]Request state[/HEADING]
 
So something new. Adding to my error above, when I do a normal test outbound mail at /admin.php?tools/test-email it delivers instantly.
When I try the sparkpost version at /admin.php?tools/test-sparkpostmail and set it to transactional emails, it takes like 3 mins or so to deliver.

Any idea what's going on Sim?

I also have server based trigger on with these results. I don't think this is the issue since I run the server trigger command manually php /home/public_html/cmd.php xf:run-jobs and it says all xf outstanding jobs have run.
 
Any idea why my cronjob from the addon is failing? Error below.
I'm pretty sure I got my API key inserted right.

How many times have you received this error?

It shouldn't occur during normal operation - the XF cron task for fetching message events doesn't run frequently enough to cause this issue.

What can happen is that if it is run multiple times in quick succession, you'll receive an error because the SparkPost API is a bit fussy about the "from" and "to" dates being too close together (even if they are actually a second apart!!). So if you had a backlog of XF jobs waiting to be processed, it might happen - but should not happen once the backlog is cleared.

So if it only happened when you first changed to the server based trigger and hasn't happened since, I wouldn't worry about it.

However, if you do continue to receive the error, please do let me know!
 
How many times have you received this error?

It shouldn't occur during normal operation - the XF cron task for fetching message events doesn't run frequently enough to cause this issue.

What can happen is that if it is run multiple times in quick succession, you'll receive an error because the SparkPost API is a bit fussy about the "from" and "to" dates being too close together (even if they are actually a second apart!!). So if you had a backlog of XF jobs waiting to be processed, it might happen - but should not happen once the backlog is cleared.

So if it only happened when you first changed to the server based trigger and hasn't happened since, I wouldn't worry about it.

However, if you do continue to receive the error, please do let me know!
Got it. It only came up once and haven't happened again.

I do have this notification that's glaring at me though since I changed it to server trigger :cry: Can't even dismiss it.... I have the server trigger command to execute every minute through Ubuntu's traditional crontab file. Any idea why I'm getting this error?
1661809649421.webp
 
So something new. Adding to my error above, when I do a normal test outbound mail at /admin.php?tools/test-email it delivers instantly.
When I try the sparkpost version at /admin.php?tools/test-sparkpostmail and set it to transactional emails, it takes like 3 mins or so to deliver.

Any idea what's going on Sim?

I also have server based trigger on with these results. I don't think this is the issue since I run the server trigger command manually php /home/public_html/cmd.php xf:run-jobs and it says all xf outstanding jobs have run.

The SparkPost test is using almost exactly the same mechanism as the core email test - the main difference is the ability to set or disable the transactional flag.

In tools/test-email what is the Email transport class set to?
 
I do have this notification that's glaring at me though since I changed it to server trigger :cry: Can't even dismiss it.... I have the server trigger command to execute every minute through Ubuntu's traditional crontab file. Any idea why I'm getting this error?

I occasionally see this error message. In theory it shouldn't happen because it only shows for jobs that are at least an hour behind schedule.

Basically, if the next trigger_date in xf_job is more than an hour ago, the message will show in the admin.

I'm not entirely sure why it shows up occasionally, but it only happens to me on my low traffic websites.

Are you stil seeing the outstanding jobs message now? It could be that you had a big backlog of jobs to be processed (cron tasks most likely) and so it was still catching up - but will eventually disappear?

If you look in the xf_job table and identify the lowest value of trigger_date and then check it againt the current time using a site like https://www.unixtimestamp.com/ - you should get an idea about when the next job is scheduled to run. If it's in the past, then you'll see the error message in the admin UI.
 
Top Bottom