Mute/disable all the error notifications

User Help for Mozilla Thunderbird
Post Reply
richiehustle
Posts: 28
Joined: April 5th, 2017, 2:15 am

Mute/disable all the error notifications

Post by richiehustle »

Is there a way to suppress all modal dialogs that originate from thunderbird,
like SMTP error notifications etc.
They're really irritating and prevent following outbox messages to be sent, because when dialog box appears it stops other mail from being sent until you click okay.

Thanks
User avatar
tanstaafl
Moderator
Posts: 49647
Joined: July 30th, 2003, 5:06 pm

Re: Mute/disable all the error notifications

Post by tanstaafl »

Not that I'm aware of.
morat
Posts: 6403
Joined: February 3rd, 2009, 6:29 pm

Re: Mute/disable all the error notifications

Post by morat »

You would need to rebuild the application to suppress the alerts.

Similar thread: http://forums.mozillazine.org/viewtopic ... &t=3037820

I guess a developer could automatically close the alerts after a few seconds with the userChrome.js file.
richiehustle
Posts: 28
Joined: April 5th, 2017, 2:15 am

Re: Mute/disable all the error notifications

Post by richiehustle »

Any idea how to accomplish that with .js plugin?
morat
Posts: 6403
Joined: February 3rd, 2009, 6:29 pm

Re: Mute/disable all the error notifications

Post by morat »

*** for advanced users only ***

There are multiple types of alerts.

Example 1...

window url: chrome://global/content/alerts/alert.xul
window title: Thunderbird
window description: Failed to connect to server imap.googlemail.com.

Example 2...

window url: chrome://global/content/commonDialog.xul
window title: Send Message Error
window description:
Sending of the message failed.
An error occurred while sending mail: Outgoing server (SMTP) smtp.googlemail.com is unknown. The server may be incorrectly configured. Please verify that your Outgoing server (SMTP) settings are correct and try again.
I got the second type of alert to automatically close after 5 seconds with the following code. I tested it using the error console.

Code: Select all

/* Thunderbird userChrome.js */

(function () {

  if (location == "chrome://messenger/content/messenger.xul") {

    var observer = {
      id: "userChromeJS_observer_1",
      get wrappedJSObject() {
        return this;
      },
      observe: function onOpen(subject, topic, data) {
        // console.log("subject: " + subject);
        // console.log("topic: " + topic);
        // console.log("data: " + data);
        // console.log("uri: " + subject.document.documentURI);
        if (topic == "domwindowopened" &&
            subject instanceof Components.interfaces.nsIDOMWindow) {
          subject.addEventListener("DOMContentLoaded", function onLoad() {
            subject.removeEventListener("DOMContentLoaded", onLoad, false);
            if (subject.document.documentURI == "chrome://global/content/commonDialog.xul") {
              // Services.ww.unregisterNotification(observer);
              // Services.wm.getMostRecentWindow("mail:3pane").inspectObject(subject); // DOM Inspector
              // console.log("uri: " + subject.document.documentURI);
              subject.setTimeout(function () { subject.close(); }, 5000);
            }
          }, false);
        }
      },
    };
    var initialized = false;
    var enumerator = Services.obs.enumerateObservers("domwindowopened");
    while (enumerator.hasMoreElements()) {
      var element = enumerator.getNext();
      if ("wrappedJSObject" in element && element.wrappedJSObject &&
          element.wrappedJSObject.id == observer.id) {
        initialized = true;
        break;
      }
    }
    if (initialized == false) {
      Services.ww.registerNotification(observer);
    }

  }

})();
I got a test dialog similar to the "Send Message Error" dialog to open in the 3pane window with the following code.

Code: Select all

Services.prompt.alert(window, "title", "description");
Similar thread: http://forums.mozillazine.org/viewtopic ... &t=3011729
richiehustle
Posts: 28
Joined: April 5th, 2017, 2:15 am

Re: Mute/disable all the error notifications

Post by richiehustle »

how to use it within Thunderbird afterwards, and what compilator to use to paste code in?
morat
Posts: 6403
Joined: February 3rd, 2009, 6:29 pm

Re: Mute/disable all the error notifications

Post by morat »

Instructions:

* install userChromeJS extension
* close email client
* create or edit the userChrome.js file in the chrome folder
* open email client with the -purgecaches command line option

i.e.

thunderbird.exe -purgecaches
ThunderbirdPortable.exe -purgecaches

You have to purge the javascript caches only after creating or editing the userChrome.js file.

http://userchromejs.mozdev.org/
http://userchromejs.mozdev.org/faq.html

Also, I believe userChromeJS 2.0 has a bug in Thunderbird 57 and above.

More info: http://forums.mozillazine.org/viewtopic ... #p14783122
Post Reply