"Stop Sending" not working when unpublished

Created on 11 February 2023, almost 2 years ago
Updated 28 April 2023, over 1 year ago

Problem/Motivation

I pushed the wrong button, "Send", on a not yet published newsletter. Not a big deal, usually, but with 3.0.0. Beta 4 "Stop sending" doesn't do anything. Clicking the button shows some activity in the address field of the browser, but except some flashing nothing has changed.

Workaround

Make sure no mail can get sent once the newsletter is published, then publish to "send" the newsletter. This will allow to stop sending, and sending testmails until you're happy.

🐛 Bug report
Status

Fixed

Version

3.0

Component

User interface

Created by

🇦🇹Austria nofue

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @nofue
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • 🇺🇸United States philsward

    Thinking I've run into the same issue. Stopping doesn't seem to work as expected?

  • Status changed to Postponed: needs info over 1 year ago
  • 🇬🇧United Kingdom adamps

    It works for me. This needs a clear "steps to reproduce" for me to be able to work on it please.

  • 🇺🇸United States philsward

    @AdamPS I don't know what to tell you for steps. It's pretty straight forward. Stop sending a news letter so you can re-send it and it acts like it doesn't stop because re-sending never works.

    The "Send Status" icon never changes from the green checkmark when stopping.

    Like nofue mentioned, selecting the news letter, choosing Stop sending and apply to selected items does refresh the page, however it never changes the "Send Status" icon. Thus, turning around and re-selecting the same newsletter and choosing "Send newsletter issue" acts like it works, but no newsletters are actually sent.

    For me, simplenews 3.x-dev is completely worthless in my environment. It was upgraded from the 2.x-dev branch which worked just fine.

    Environment is PHP 8.0.28

  • 🇦🇹Austria nofue

    @AdamPS

    Here's the step by step you requested:

    1.) Create a newsletter
    2.) Set the node to 'unpublished'
    3.) click the newsletter tab
    4.) click "send"

    Now the newsletter is in "sending state" (message reads something like "will be sent once published") and it's impossible (at least for me) to "stop sending" in this state. It's also impossible to edit that newsletter, because it is in the sending state.

    Workaround, as stated above:

    1.) Make sure your machine cannot send messages (f.e. changing settings in the mail transport module -- I set the transport method to some not working transport, like SMTP without proper credentials. If your cron is running only once in a while, you should have plenty of time for the following steps anyway)
    2.) Publish the node
    3.) Now you can "stop sending"
    4.) revert the changed transport settings (or whatever you did to keep simplenews from sending the newsletter)
    5.) Edit along merrily.

    @philsward -- I cannot agree with your observation. I have simplenews/symfony mailer on (at least) six installations doing a marvellous job. It took me a weekend to get the first site going, but that's long done. The six sites have sent at least 20 news-issues to a total of more than 15000 receivers. So it's far from "unusable" for me, to the contrary, it's the best simplenews/mailer combo ever.

  • Status changed to Active over 1 year ago
  • 🇬🇧United Kingdom adamps

    Great thanks I see it now. I was missing step 2 "unpublished" - which I agree was mentioned, however it's much easier to see with "steps to reproduce"😃. Let's make the title more obvious too.

  • Status changed to Needs review over 1 year ago
  • 🇬🇧United Kingdom adamps

    The test was wrong - it checked for the same wrong result that the old code generated.

  • 🇺🇸United States philsward

    Even with the patch, I am unable to use the "Stop Sending" functionality.

    @AdamPS I'm sure the module works great in your environment, but I'm saying it doesn't work in mine.

    For my workflow, I don't create a new newsletter for every issue, I re-use the same newsletter. All of the info in the newsletter is dynamically created through a View on a daily basis based on the content of the site so there's no reason for me to have to create a new newsletter and send it off like a "normal" workflow might dictate.

    In the past, I simply stopped sending, then did a Send Newsletter which would trigger the same newsletter to send again. This unfortunately isn't working now.

    Like I stated before, v2 would show a clock while sending. Successfully finished would show the checkmark. I think stop sending would remove the icons completely? v3 on the other-hand shows the checkmark for successfully sending all of the newsletters but stop sending does not remove this checkmark making it act like it never stops sending. Attempting a re-send doesn't ever send anything making it feel like stop sending isn't actually working. Visually, it certainly doesn't "look" like it stops sending.

  • 🇺🇸United States philsward

    Update:

    I'm not a coder, but sometimes I can find a piece to a puzzle.

    This was changed in the patch:

    @@ -267,7 +267,7 @@ class SpoolStorage implements SpoolStorageInterface {
        * {@inheritdoc}
        */
       public function deleteIssue(ContentEntityInterface $issue) {
    -    if ($issue->simplenews_issue->status != SIMPLENEWS_STATUS_SEND_PENDING) {
    +    if (!in_array($issue->simplenews_issue->status, [SIMPLENEWS_STATUS_SEND_PENDING, SIMPLENEWS_STATUS_SEND_PUBLISH])) {
           return;
         }
    

    I added the status to the + line:

    SIMPLENEWS_STATUS_SEND_READY,
    

    Which makes:

        if (!in_array($issue->simplenews_issue->status, [SIMPLENEWS_STATUS_SEND_READY, SIMPLENEWS_STATUS_SEND_PENDING, SIMPLENEWS_STATUS_SEND_PUBLISH])) {
    

    Whether it's right or not, I don't know, however stopping the send "appears" to work.

    I can't get the emails to actually fire off yet which may be another issue altogether, but at least adding the SEND_READY to that line makes the stopping appear to do what it's supposed to.

  • 🇺🇸United States philsward
    ECDHE-ECDSA-AES128-GCM-SHA256:128 CV=yes: SMTP error from remote mail server after end of data: 550-5.7.26 Unauthenticated email from xyzdomain.example is not accepted due to\n550-5.7.26 domain's DMARC policy. Please contact the administrator of\n550-5.7.26 xyzdomain.example domain if this was a legitimate mail. Please\n550-5.7.26 visit\n550-5.7.26 https://support.google.com/mail/answer/2451690 to learn about the\n550 5.7.26 DMARC initiative. n197-20020a25d6ce000000b00b673b42fbecsi13274724ybg.705 - gsmtp
    

    From what I can gather, Drupal isn't setting the correct "from" address and due to DMARC my server is blocking it.

    So yes, the email not sending is on my end. However, checking past attempts with SimpleNews to stop and start the message, it did not actually attempt to send the message until after I added the SIMPLENEWS_STATUS_SEND_READY bits.

    Hope this is confirmable and not a random freak coincidence.

  • 🇬🇧United Kingdom adamps

    In the past, I simply stopped sending, then did a Send Newsletter which would trigger the same newsletter to send again. This unfortunately isn't working now.

    This is not something that's intended to work - reusing newsletters is not currently supported and once the newsletter has finished sending, then the stop sending button should no longer be present. There is a feature request for it Allow resending of newsletters Fixed . Or maybe this module could help you but I haven't tested it: https://www.drupal.org/project/simplenews_resend .

    This issue is for a specific problem with the steps in #7. If have problems with a different set of steps then please use a different issue.

  • 🇺🇸United States philsward

    I'm confused though... This worked fine on v2 but it's being stripped from v3?

    So all that is needed to fix Allow resending of newsletters Fixed is to add SIMPLENEWS_STATUS_SEND_READY in the area mentioned above?

  • 🇬🇧United Kingdom adamps

    The code was changed in #3052727: Create clear consolidated functions to send/cancel newsletters . I don't really agree it "worked fine" in v2. The purpose of the "Stop sending" button is to stop sending any more emails. Most commonly it would be used before any were sent; it could also be used to abort part way, but then it's not really possible to continue sending as there is no record of who to resend to. Once the newsletter has been sent, it's no longer possible to stop sending, hence the button is should longer be shown. You were using "Stop sending" to reset the newsletter so you could send it again. It is random chance that it worked in that way - it was not logical nor was it the intention.

    For Allow resending of newsletters Fixed , the button should be named "Reset". It should likely reset the statistics. There is a very real danger of sending the same newsletter to the same people, which would tend to be called spam. So maybe it should only work if you reset the newsletter content at the same time (which I guess, you would be happy to do). At minimum there should be a clear warning of the dangers.

    It seems to me that creating a new newsletter is not so hard. It has the advantage that you get a clear history of when you sent out newsletters and how many people it was sent to.

  • 🇦🇹Austria nofue

    @philsward : My solution "to your problem" (at least in part) was to create a new content type "canned news" where I put all the content I wanted to resend into the template fields. So whenever I create a new newsletter, everything is already in place, and if there are changes, like a different date or such, it's an easy task to change that in a second. Hope this helps your use of s/m.

  • 🇺🇸United States philsward

    @AdamPS

    The code was changed in #3052727: Create clear consolidated functions to send/cancel newsletters. I don't really agree it "worked fine" in v2. The purpose of the "Stop sending" button is to stop sending any more emails. Most commonly it would be used before any were sent; it could also be used to abort part way, but then it's not really possible to continue sending as there is no record of who to resend to. Once the newsletter has been sent, it's no longer possible to stop sending, hence the button is should longer be shown. You were using "Stop sending" to reset the newsletter so you could send it again. It is random chance that it worked in that way - it was not logical nor was it the intention.

    This does make more sense. For now I'll just use the work-around until it gets stripped completely, then take a look at the resend module you suggested.

    I guess make a note that there is "some" demand for the need to resend an existing issue so building it into simplenews might be warranted.

  • 🇬🇧United Kingdom adamps

    @nofue If you can confirm the patch solves your problem then I will commit the fix
    @philsward 😃 Could also be worth a look at https://www.drupal.org/project/simplenews_resend

  • 🇦🇹Austria nofue

    As I put the last evaluation site online, I have to begin testing simplenews on my newest site earlier than expected. I'll try to have the subscription part ready soon, then run some tests in a clear environment, also playing with transport modes to close some of my blind spots before getting my hands to that part of the tutorial/manual …

  • 🇦🇹Austria nofue

    Yup, works for me.

    Actually, there was that newsletter still stuck from my initial request, and after applying the patch, it became immediately available for editing again.

    However, your request sent me into some hoops … A crash course in "how to apply patches using composer", plus a heads up to "do not edit a composer.json on one site while hoping for things to happen in another". Oh, well. You made my Saturday ;)

    One more thing off the list -- thanks to everybody involved.

  • 🇦🇹Austria nofue

    @philsward:

    Even with the patch, I am unable to use the "Stop Sending" functionality.

    Have you made composer requiring the .dev version of simplenews? I.e.

    composer require 'drupal/simplenews:3.x-dev'

    The patch won't work for …-beta4

    • AdamPS committed 98b1e77d on 3.x
      Issue #3341062 by AdamPS, nofue: "Stop Sending" not working when...
  • 🇬🇧United Kingdom adamps

    Great thanks for the confirmation. New release coming soon.

  • Status changed to Fixed over 1 year ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024