Extended-Thunder / send-later

Schedule messages to be sent at a specific time.
Mozilla Public License 2.0
114 stars 17 forks source link

Scheduled mail never sent if mail server is unreachable when scheduled time arrives...until another scheduled mail is created and successfully sent #338

Open cperrier opened 3 years ago

cperrier commented 3 years ago

Hello,

The issue I'd like to report is a bit difficult to describe and may require work to reproduce the conditions of what seems to be a bug. It may look similar to #16 but I think it's not exactly the same problem.

Context : I use TB for my work mail. Our mail server is an IMAP mail server on the company's internal network. We use a VPN connection for remote working. The IMAP server can't be reached if the VPN is down. When the VPN is up, the IMAP server is accessed throught the VPN.

If I schedule mailsending through Send Later, and TB as well as the VPN are UP when the scheduled mail is to be sent, everything works as expected. In the meantime, the scheduled mail is kept in my Drafts folder (which is located on the IMAP server).

If I schedule mail sending through Send Later and if Thunderbird is down when the scheduled mail is to be sent, then of course, the mail is only sent when I launcht Thunderbird as long as the VPN is up

However, if TB is UP when the scheduled time is reached and the VPN is down, then obviously, the mail can't be sent. Then, TB displays its current warning about the mail host not being reachable (L’envoi du message a échoué. Le message n’a pas pu être envoyé car la connexion au serveur sortant (SMTP) « xxxxxxxxxxxxxxxxxxxx » a expiré. Veuillez essayer à nouveau.). OK, that's expected (Message in French, but you can probably guess. If not, I can translate).

The mail then appear in my LOCAL "Scheduled mails" folder and NO LONGER in my Drafts mail (which is anyway unreachable).

Still, if I reconnect the VPN conenction.....then the scheduled mail is NOT sent but it reappears in my "Drafts" folder while still appearing ALSO in the local Scheduled mails folder. Still, I can wait as long as I want, the mail will never be sent.

I then have two copies on the scheduled mail : one sitting in "Drafts", another one sitting in "Scheduled mails"

Until....

....until, indeed, I schedule ANOTHER scheduled mail. Then, when the time to send the second scheduled mail.....the first one is sent also....:-). And more funnily, it disappears from "Schduled mails" BUT NOT from Drafts. So, it may mistakenly give the feeling that the mail hasn't been sent while it has.

So, as far as I can see, this combines two issues :

It's of course a bit tricky to reproduce with a standard mail server....but I suspect this can be faked by the following :

jph-sendlater commented 3 years ago

Good catch. I'm surprised this bug hasn't been reported before. When the message reappears in your Drafts folder, does it still show a scheduled time?

I don't have much time to work on this immediately, but it'll be high on my priority list as soon as I get a chance.

cperrier commented 3 years ago

Yes, when the message reappears in the Drafts folder, it still shows a scheduled time.

Thanks a lot for your very quick response!

Le lun. 14 juin 2021 à 17:53, jph-sendlater @.***> a écrit :

Good catch. I'm surprised this bug hasn't been reported before. When the message reappears in your Drafts folder, does it still show a scheduled time?

I don't have much time to work on this immediately, but it'll be high on my priority list as soon as I get a chance.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Extended-Thunder/send-later/issues/338#issuecomment-860795619, or unsubscribe https://github.com/notifications/unsubscribe-auth/AM52Y46C46RW6J7H2XY4UVLTSYQW5ANCNFSM46VLQ2FA .

jph-sendlater commented 3 years ago

Just to verify that I have this right, the two issues here are:

  1. Thunderbird is not getting the signal to 'send unsent messages' when it re-establishes a VPN connection. (for what it's worth, you can force this to happen with File > Send Unsent Messages, rather than re-sending the message from your Drafts folder). This is something that needs to be fixed in Thunderbird. Send Later could work around it by periodically triggering that signal in the background, but that could cause unexpected behavior for people who use the outbox outside of this extension. I recommend opening a bug report with the Thunderbird developers about that (https://bugzilla.mozilla.org/buglist.cgi?product=Thunderbird)
  2. When a message is moved from Drafts to the Outbox without an internet connection, Thunderbird apparently doesn't sync that information to the IMAP server next time it connects, so the message "reappears". This one is also a Thunderbird issue, but Send Later can do something about this one. Would it be helpful if Send Later replaces the schedule time with a warning message that explains the situation?
cperrier commented 3 years ago

Thanks for your analysis.

I tried reporting https://bugzilla.mozilla.org/show_bug.cgi?id=1718549 to TB. I tried to explain the issue as clearly as possible and giving the link to the current issue. Of course, feel free to complete this bug report in case I haven't been clear or precise enough.

Thanks again for all of your work. Even though I report these issues, Send Later is a huge help for my current daily work and the respect of my fellow colleagues at work.

For your 2. suggestion, it would probably help (of course, once one has been hit by the issue and able to understand it, it's easy to avoid sending the message twice but a warning would help, sure)

jobisoft commented 2 years ago

Could you check if the network:offline-status-changed observer is being triggered, when your VPN comes back up? https://searchfox.org/comm-central/rev/3c133febc21c02f8b6ef1d658b2f2bfd4bb72e8b/mail/base/content/mail-offline.js#77-81

This is a very special case, which probably is too much for Thunderbirds offline detect mechanism. If I understand this correct, then internet is working ok, just the connection to the IMAP server is lost when VPN is down?

jikamens commented 1 year ago

@cperrier is this issue still reproducible for you? I'm specifically interested in knowing whether the Drafts folder inconsistency is still happening. As @jph-sendlater pointed out, that's a TB issue and if it's still happening we should figure out how to get it into the TB bug queue if it isn't there already so it can be addressed at the root.

I'm not sure whether the offline/online trigger thing is something Send Later can reasonably address. See the comment I just added to the bugzilla ticket you opened for more about that.