Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
We originally configured Simplenews to run via cron. Something broke and now every time we run cron, it attempts to send out a newsletter. Our members are furious, and we're terrified of running cron (which is not, thankfully, automated yet). If there's a sending of a newsletter stuck in a queue somewhere, how do we get rid of it? Thanks!
Comment | File | Size | Author |
---|---|---|---|
#26 | screenshot-purge.png | 13.6 KB | Alan D. |
#26 | simplenews-289068-26-purge-newsletter-option.patch | 1.83 KB | Alan D. |
Comments
Comment #1
Sutharsan CreditAttribution: Sutharsan commentedIf you are looking for a one time fix, I guess a solution directly in the database is no problem.
In the simplenews_mail_spool table holds data for all the newsletters (recently send and) to be send.
The status field is the individual email status. 1 = pending; 2 = send. Records with status = 1 will be (re-)send at the next cron run. Change a '1' to '2' and the record is marked send.
Note that this queue is also used when sending without cron. When you send a newsletter and there are records with status = 1 still in the spool they will be send too.
In future releases I hope to create an interface for this spool, but currently none is available.
Comment #2
labourstart CreditAttribution: labourstart commentedThanks very much -- let's hope this solves the problem and we can use simplenews.
Comment #3
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #4
emdesign CreditAttribution: emdesign commentedI am experiencing the same problems as the original poster. Our site is using 5.x-1.2. Does the simplenews_mail_spool fix work for this version as well? I did not install Drupal, so I'm having trouble finding the simplenews_mail_spool table. Can you tell me where to locate it?
Comment #5
hansrossel CreditAttribution: hansrossel commentedTo stop a newsletter that is sending you can use the following code:
Comment #6
sliveroix CreditAttribution: sliveroix commentedwhere to post these codes?
Comment #7
miro_dietikerUse e.g. drush eval in command line.
Or you put the SQL directly into e.g. phpmyadmin and remove curly braces.
Comment #8
enkara CreditAttribution: enkara commentedI don't have the simplenews_mail_spool table, but it would be really nice to have a button to stop the newsletters
Comment #9
miro_dietikerReopening this issue as a feature request for Drupal 7 development.
The lack of this feature in general is very limiting.
Comment #10
BerdirClosed #1271242: Stop sending Newsletters as a duplicate.
Related to #1169990: Improve usability and displayed information on the newsletter tab which is about general/UX improvements to the newsletter tab, so updating the issue title
Comment #11
BerdirSeparating this from the previously mentioned issue, a stop button will be added there, this is only about adding a corresponding action on the newsletter overview.
Comment #12
BerdirComment #13
Jelmer85 CreditAttribution: Jelmer85 commentedHoly shit, thank you so much. You saved my life :D Sort of...
(I simply added this to a node with the PHP filter enabled. After having backed up my Database of course)
Comment #14
miro_dietikerSince this is such a severe issue we'd like to make the world better and avoid sending spam. ;-)
Stop is simply a major UX requirement.
Comment #15
russellb CreditAttribution: russellb commentedThere seem to have been some changes since the code fragment was posted above. I've just been through this process on simplenews 7.x-1.1 and changed the fragment as follows:
+1 for this being a very desirable feature in the UI!
Comment #16
miro_dietikerThe feature "Stop sending!" should introduce a new state "Aborted" for a newsletter.
Also, first it's not about deleting the queue. It's about stop processing it.
We might exclude "aborted" newsletters in cron. Possibly, we should also update the spool records states to "aborted".
And sure, all these commands should eat newsletter issue nid to properly limit scope.
Later we could offer a "Purge" and a "Resume" button...
Comment #17
russellb CreditAttribution: russellb commentedHi Miro,
That sounds great! Equally a simple stop & purge link would be welcome as an incremental improvement, pending development of a full stop, purge and resume system.
Comment #18
miro_dietikerHere we go!
A first super minimalistic version of the stop button has been implemented in 8.x through the node newsletter tab while sending.
Looking forward to further improvements.
Comment #19
Berdir#2413995: Replace newsletter issue overview with views will add this to the newsletter overview, so removing the 8.x tag :)
Comment #20
corvus_ch CreditAttribution: corvus_ch commentedComment #21
Alex2.0 CreditAttribution: Alex2.0 commentedIs this feature already implemented in 7.x? I can't find it anywhere....
Comment #22
miro_dietikerNo and that's why the issue is still open as a feature request.
Comment #23
Alan D. CreditAttribution: Alan D. commentedA kill switch if a critical feature of a newsletter system, cause when they go wrong, they go really badly wrong.
Only personally had the misfortune of this happened twice, 12 years ago that nearly resulted in legal action against the company (crappy custom inhouse cms was to blame) and today. About 1,000 emails sent to students from around the world before it was picked up and blocked (luckily using SMTP, so it was easy to disable emails for the time being)
What is the best way to do this without access to the command line / db in Drupal 7?
Deploy russellb solution into an update script? Or would simply deleting the newsletter node be enough?
Comment #24
miro_dietiker@Alan D. My words, i would fully support its criticalness. But well, you know, it really can't be that critical!
I proposed its implementation so many times to customers or sprint goals. But no one supported its implementation.. So we left this open as a challenge to the community.
And then the team found motivation to still do it for Drupal 8 in a rush of implementing "features that should have been part of Simplenews since day one"... But the energy didn't reach for a D7 backport.
If you want to bring it into an installation, checkout D8 and implement a kill switch button and a submit handler. And provide the patch here. It's basically the same complexity as writing an update hook...
Comment #25
Alan D. CreditAttribution: Alan D. commentedI was simply querying a simple workaround to avoid creating additional costs to the client, prefer to be working on more constructive outcomes for them rather than chasing issues ;)
But did want to emphasis the negatives of not having this!
Comment #26
Alan D. CreditAttribution: Alan D. commentedA kick start if anyone needs it. Single client using this on an old branch, and no idea what direction D8 took, so tmp solution for old version.
Adds new form with a purge option on node/%/simplenews
Action flags as sent, purges the queue and unpublishes the node. No conditional actions.
[edit]
I ended up removing the published node step as this confused the clients workflow, since they normally publish nodes to trigger the newsletter getting sent. If they want to hide it, they can manually handle that!