{
  "schemaVersion": 1,
  "$comment": [
    "Single source of truth for expected provider settings, read by BOTH the",
    "Python CLI and the JavaScript webapp -- the way dns-scripts uses",
    "records.json. Add a provider or a field once and both front-ends pick it",
    "up. Never hard-code an expected value in either front-end.",
    "",
    "Enum spellings for socketType and authMethod must match the vocabularies",
    "in troubleshooting_info.py exactly, because they are compared against",
    "parser output. tests/test_settings.py asserts that, so a typo here fails",
    "the suite rather than silently never matching.",
    "",
    "CONVENTION: any key beginning with '$' is documentation. Both front-ends",
    "must ignore them -- JSON has no comment syntax, and the reasoning behind",
    "these values is worth keeping next to the values themselves."
  ],

  "verdicts": {
    "$comment": [
      "Three levels, not two. Reporting a working app-password account as",
      "broken sends support down the wrong path, so 'the settings work but are",
      "not what we recommend' needs its own level."
    ],
    "pass": "Settings are correct.",
    "warn": "Settings work, but are not what the provider recommends.",
    "fail": "Settings are wrong, or cannot work."
  },

  "ui": {
    "$comment": [
      "Thunderbird Account Settings labels, so remediation can name the exact",
      "field and the exact value to select, following the dns-scripts style.",
      "",
      "Transcribed from TB 153 on 2026-07-27: screenshots of both",
      "Authentication method dropdowns, and both menu paths. The Connection",
      "security dropdown was confirmed to offer the same three options -- None,",
      "STARTTLS, SSL/TLS -- in both the incoming and SMTP Server dialogs.",
      "",
      "THE TWO DROPDOWNS ARE NOT THE SAME LIST. Incoming offers 'TLS",
      "Certificate' and has no 'No authentication'; the SMTP Server dialog",
      "offers 'No authentication' and has no 'TLS Certificate'. So an",
      "authMethod is selectable *in a direction*, not in general, and",
      "remediation must be told which dialog it is talking about."
    ],
    "verified": true,
    "$unverified": [
      "Whether Thunderbird 150 is exactly the version where the app menu's",
      "'New Account' became 'Add Account'. Issue #7 asks Wayne Mery. The",
      "remediation names both wordings, so a wrong boundary changes nothing."
    ],

    "$addAccountComment": [
      "Deliberately names both wordings instead of branching on the version.",
      "",
      "The menu item is 'Add Account' in Thunderbird 150 and above and 'New",
      "Account' in 149 and below -- but this tool frequently cannot tell",
      "which one it is talking to. App Basics labels are localised, so a",
      "non-English dump yields no version, and support staff routinely paste",
      "only the accounts fragment, which has no App Basics section at all.",
      "CLAUDE.md's rule is that an unknown version stays unknown rather than",
      "being assumed, and a volunteer reading both wordings loses nothing,",
      "while one reading a confidently wrong single wording goes hunting for",
      "a menu item that is not there.",
      "",
      "Whether 150 is exactly the right boundary is unconfirmed -- see issue",
      "#7, which asks Wayne Mery. Naming both is also what makes that",
      "uncertainty harmless."
    ],
    "addAccountLocation": "Thunderbird app menu ☰ → Add Account → Email (the menu item is called New Account in Thunderbird 149 and earlier)",

    "locations": {
      "$comment": [
        "Keyed by the 'direction' on each protocol below, so the engine can",
        "name the right dialog without hard-coding either string.",
        "",
        "DO NOT route people through the sidebar's 'Outgoing Server' entry,",
        "even though it reaches the same SMTP Server dialog. That page is a",
        "global list of every SMTP server across all accounts, and the rows",
        "carry only a description and a hostname: a real profile shows three",
        "consecutive rows all reading 'Thundermail - mail.thundermail.com',",
        "with nothing to distinguish them. Sending someone there to fix one",
        "account invites them to edit a different one. Reaching the dialog",
        "from the account's own page cannot pick the wrong server.",
        "",
        "This is the same problem this tool has, for the same reason, and it",
        "is why verdicts identify accounts by protocol/host/port and dump",
        "order: on this host, the name tells you nothing."
      ],
      "incoming": "Thunderbird app menu ☰ → Account Settings → the account's Server Settings in the left sidebar",
      "outgoing": "Thunderbird app menu ☰ → Account Settings → click the account's own row in the left sidebar, not one of the entries beneath it → Outgoing Server, second-to-last row at the bottom right → Edit outgoing server… (opens the SMTP Server dialog)"
    },
    "$accountSelectionComment": [
      "The sidebar lists accounts by email address, which this tool discards",
      "and never has. So remediation must say 'select the account for the",
      "mailbox you are fixing' and identify it by protocol/host/port and dump",
      "order, exactly as CLAUDE.md requires -- never fill an address into",
      "these strings, and never ask the user for one to put there."
    ],

    "fieldLabels": {
      "$comment": [
        "The SMTP Server dialog additionally has a free-text 'Description'",
        "field, which no verdict depends on.",
        "",
        "These are the editable dialogs' labels. The read-only 'Details of",
        "selected server' pane on the Outgoing Server page capitalises one of",
        "them differently -- 'Connection Security' -- so do not 'correct' the",
        "lower-case s here to match a screenshot of that pane."
      ],
      "host": "Server Name",
      "port": "Port",
      "socketType": "Connection security",
      "authMethod": "Authentication method"
    },

    "socketTypeChoices": {
      "$comment": [
        "Same shape as authMethodChoices below, and for the same reason: what",
        "matters is whether a value is *selectable*, not just what it is called.",
        "",
        "The Connection security dropdown offers exactly three options, and it",
        "offers the same three in the incoming and SMTP Server dialogs.",
        "",
        "trySTARTTLS is the interesting one. It has been removed from",
        "MailNewsTypes2.idl and no dropdown entry corresponds to it, but an old",
        "profile can still hold the value, so the parser must decode it. It is",
        "recorded here as offered nowhere rather than guessed at: an earlier",
        "revision labelled it 'STARTTLS', which asserted something about the UI",
        "that nobody had looked at. What Thunderbird displays for a stored 1 is",
        "still unknown; the point is that the tool no longer needs to know,",
        "because there is no version of this that ends in telling someone to",
        "select trySTARTTLS."
      ],
      "plain": { "label": "None", "offeredIn": ["incoming", "outgoing"] },
      "alwaysSTARTTLS": { "label": "STARTTLS", "offeredIn": ["incoming", "outgoing"] },
      "SSL": { "label": "SSL/TLS", "offeredIn": ["incoming", "outgoing"] },
      "trySTARTTLS": { "label": null, "offeredIn": [] }
    },

    "authMethodChoices": {
      "$comment": [
        "'offeredIn' lists the dialogs whose dropdown contains this choice, in",
        "the order the menus list them. An empty list with a null label means",
        "the value exists in nsMsgAuthMethod but Thunderbird offers no such",
        "choice anywhere: an account holding one got it from an old profile or",
        "an autoconfig file, and the fix is to pick a supported method rather",
        "than to re-select the same one.",
        "",
        "A provider must not accept a method that is not offered in that",
        "protocol's direction -- tests/test_settings.py enforces it -- because",
        "the remediation would tell someone to choose something not in the menu."
      ],
      "none": { "label": "No authentication", "offeredIn": ["outgoing"] },
      "passwordCleartext": { "label": "Normal password", "offeredIn": ["incoming", "outgoing"] },
      "passwordEncrypted": { "label": "Encrypted password", "offeredIn": ["incoming", "outgoing"] },
      "GSSAPI": { "label": "Kerberos / GSSAPI", "offeredIn": ["incoming", "outgoing"] },
      "NTLM": { "label": "NTLM", "offeredIn": ["incoming", "outgoing"] },
      "External": { "label": "TLS Certificate", "offeredIn": ["incoming"] },
      "OAuth2": { "label": "OAuth2", "offeredIn": ["incoming", "outgoing"] },
      "old": { "label": null, "offeredIn": [] },
      "secure": { "label": null, "offeredIn": [] },
      "anything": { "label": null, "offeredIn": [] }
    }
  },

  "$matcherComment": [
    "'rules' and 'knownIssues' below share one matcher. Every key in a 'when'",
    "object must hold for the entry to fire, and an absent key matches",
    "anything. Supported keys:",
    "",
    "  protocol      imap | pop3 | jmap | smtp, as the parser reports it",
    "  direction     incoming | outgoing",
    "  port          exact integer",
    "  socketType    exact enum name",
    "  authMethod    exact enum name",
    "  hostSuffix    case-insensitive suffix of the hostname",
    "  hostNotOneOf  list of hostnames that must NOT match, case-insensitive",
    "",
    "Deliberately no regular expressions: the matcher is evaluated by both a",
    "Python and a JavaScript implementation, whose regex flavours differ in",
    "ways that would be discovered by a wrong verdict rather than by a test."
  ],

  "rules": [
    {
      "id": "cleartext-over-plain-socket",
      "$comment": [
        "Judge the pair, not the field alone. passwordCleartext over SSL or",
        "STARTTLS is fine -- the password is encrypted in transit by the",
        "socket. Over a plain socket it crosses the network readable, which is",
        "a genuine defect regardless of what the provider recommends.",
        "This outranks any per-provider authMethod verdict."
      ],
      "appliesTo": "allProviders",
      "when": { "authMethod": "passwordCleartext", "socketType": "plain" },
      "verdict": "fail",
      "message": "The password is sent unencrypted over an unencrypted connection.",
      "remediation": "Set Connection security to SSL/TLS or STARTTLS, using the port the provider expects for that setting."
    }
  ],

  "knownIssues": [
    {
      "$comment": [
        "The catalogue of recognisable bad configurations. It answers the",
        "third question this tool exists for: is this a known bad config, as",
        "opposed to merely 'not what we expected'.",
        "",
        "These fire *in addition to* the generic server mismatch, not instead",
        "of it. The mismatch says what the settings should be; a catalogue",
        "entry says what specifically is wrong with what they are, which is",
        "the difference between a volunteer copying values across and a",
        "volunteer understanding the problem.",
        "",
        "'observed' records whether we have actually seen the configuration in",
        "a real support case, as opposed to deriving it. Every entry below is",
        "false: they are structural certainties -- combinations that cannot",
        "work, whoever tries them -- but nobody has yet counted how often they",
        "turn up. Do not let output imply a frequency we have not measured,",
        "and flip the flag as real cases arrive."
      ],
      "id": "implicit-tls-port-with-starttls",
      "appliesTo": "allProviders",
      "when": { "port": 465, "socketType": "alwaysSTARTTLS" },
      "verdict": "fail",
      "observed": false,
      "message": "Port 465 with STARTTLS cannot connect. Port 465 expects the connection to be encrypted from the first byte, but STARTTLS begins in the clear and asks to upgrade, so the server never answers in a way Thunderbird understands.",
      "remediation": "Either set Connection security to SSL/TLS and keep port 465, or keep STARTTLS and change the port to 587. Both are valid; they just have to agree.",
      "provenance": "RFC 8314 §3: 465 is implicit TLS (submissions), 587 is the STARTTLS submission port. Derived from the specification, not from an observed support case."
    },
    {
      "id": "starttls-port-with-implicit-tls",
      "appliesTo": "allProviders",
      "when": { "port": 587, "socketType": "SSL" },
      "verdict": "fail",
      "observed": false,
      "message": "Port 587 with SSL/TLS cannot connect. Port 587 expects a plain connection that is upgraded with STARTTLS, but SSL/TLS starts encrypting immediately, so the two ends never agree.",
      "remediation": "Either set Connection security to STARTTLS and keep port 587, or keep SSL/TLS and change the port to 465. Both are valid; they just have to agree.",
      "provenance": "RFC 8314 §3, as above. Derived from the specification, not from an observed support case."
    },
    {
      "id": "imaps-port-without-implicit-tls",
      "appliesTo": "allProviders",
      "when": { "protocol": "imap", "port": 993, "socketType": "alwaysSTARTTLS" },
      "verdict": "fail",
      "observed": false,
      "message": "Port 993 with STARTTLS cannot connect. Port 993 is the implicit-TLS IMAP port and expects encryption from the first byte; STARTTLS on IMAP belongs on port 143.",
      "remediation": "Set Connection security to SSL/TLS, which is what port 993 expects.",
      "provenance": "RFC 8314 §3: 993 is imaps, 143 is IMAP with STARTTLS. Derived from the specification, not from an observed support case."
    },
    {
      "$comment": [
        "The most useful entry here, because it fires exactly when provider",
        "detection cannot. A guessed hostname means no provider matches, so",
        "the account would otherwise be reported as 'not checked' -- the least",
        "helpful possible answer to someone who has simply typed the wrong",
        "server name.",
        "",
        "imap./smtp./pop. prefixes are the near-universal convention, which is",
        "precisely why someone would assume them. Thundermail uses one host",
        "for everything."
      ],
      "id": "guessed-thundermail-hostname",
      "appliesTo": "allProviders",
      "when": {
        "hostSuffix": ".thundermail.com",
        "hostNotOneOf": ["mail.thundermail.com"]
      },
      "verdict": "fail",
      "observed": false,
      "message": "Thundermail uses one server name for everything: mail.thundermail.com. There is no separate imap., smtp. or pop. host, so a name like this will not resolve.",
      "remediation": "Set Server Name to mail.thundermail.com, for both incoming and outgoing mail.",
      "provenance": "pulumi/config.prod.yaml in thunderbird/thunderbird-accounts and the published SRV records both point at the single host mail.thundermail.com. Derived from configuration, not from an observed support case."
    }
  ],

  "providers": [
    {
      "id": "thundermail",
      "displayName": "Thundermail",
      "verified": true,
      "$comment": [
        "From pulumi/config.prod.yaml in thunderbird/thunderbird-accounts,",
        "confirmed against the Thundermail 'View Server Settings' UI and the",
        "published SRV records."
      ],

      "match": {
        "$comment": [
          "Provider is detected from the incoming hostname, never from an",
          "email address. That needs no input from the user and still works",
          "for custom domains, since the RFC 6186 SRV target is the same host.",
          "Hosts are compared case-insensitively against the parsed host."
        ],
        "hosts": ["mail.thundermail.com"]
      },

      "autoconfig": {
        "$comment": [
          "No ISPDB entry -- autoconfig.thunderbird.net/v1.1/thundermail.com",
          "404s -- so Thunderbird discovers Thundermail via RFC 6186 SRV",
          "records. Those records are the reason an account's settings look",
          "the way they do, which makes dns-scripts the natural cross-link."
        ],
        "ispdb": false,
        "srv": ["_imaps._tcp", "_submission._tcp"],
        "crossCheck": "https://github.com/thunderbird/dns-scripts"
      },

      "protocols": {
        "imap": {
          "direction": "incoming",
          "supported": true,
          "servers": [
            {
              "host": "mail.thundermail.com",
              "port": 993,
              "socketType": "SSL",
              "provenance": "The _imaps._tcp SRV record, the Thundermail UI and pulumi/config.prod.yaml all agree."
            }
          ],
          "authMethods": {
            "recommended": "OAuth2",
            "accepted": {
              "OAuth2": {
                "verdict": "pass",
                "note": "The default and recommended authentication for Thundermail."
              },
              "passwordCleartext": {
                "verdict": "warn",
                "note": "An app password works, but OAuth2 is the default and is recommended. Not a reason to change a working account."
              }
            },
            "otherwise": {
              "verdict": "fail",
              "note": "Thundermail expects OAuth2, or an app password with Normal password."
            }
          }
        },

        "smtp": {
          "direction": "outgoing",
          "supported": true,
          "$comment": [
            "BOTH server rows are valid -- accept either, do not pick one.",
            "Thundermail publishes _submission._tcp -> 587, and under RFC 6186",
            "_submission._tcp is the STARTTLS service on 587 (as opposed to",
            "_submissions._tcp for implicit TLS on 465). So an autoconfigured",
            "account lands on 587/alwaysSTARTTLS while the Thundermail web UI",
            "tells users to type 465/SSL.",
            "",
            "Encoding only 465/SSL -- which config.prod.yaml and the UI",
            "screenshot suggest in isolation -- would report a false failure",
            "for every autoconfigured Thundermail account. This is why this is",
            "a set of acceptable pairs rather than one expected value per",
            "field. Verified against a real profile containing both variants.",
            "",
            "The DNS-vs-UI inconsistency is Thundermail's, not ours."
          ],
          "servers": [
            {
              "host": "mail.thundermail.com",
              "port": 587,
              "socketType": "alwaysSTARTTLS",
              "provenance": "The _submission._tcp SRV record (RFC 6186) -- what Thunderbird autoconfig produces, since Thundermail has no ISPDB entry."
            },
            {
              "host": "mail.thundermail.com",
              "port": 465,
              "socketType": "SSL",
              "preferredForRemediation": true,
              "provenance": "The Thundermail web UI's manual setup instructions.",
              "$comment": [
                "Preferred only for phrasing a fix, because it is what",
                "Thundermail's own instructions tell a user to type, so a",
                "volunteer cross-checking the vendor UI sees the same values.",
                "587/alwaysSTARTTLS is equally correct and must never be",
                "reported as wrong. Revisit if Thundermail aligns its docs",
                "with its SRV records."
              ]
            }
          ],
          "authMethods": {
            "recommended": "OAuth2",
            "accepted": {
              "OAuth2": {
                "verdict": "pass",
                "note": "The default and recommended authentication for Thundermail."
              },
              "passwordCleartext": {
                "verdict": "warn",
                "note": "An app password works, but OAuth2 is the default and is recommended. Not a reason to change a working account."
              }
            },
            "otherwise": {
              "verdict": "fail",
              "note": "Thundermail expects OAuth2, or an app password with Normal password."
            }
          }
        },

        "pop3": {
          "direction": "incoming",
          "supported": false,
          "verdict": "fail",
          "message": "POP isn't supported — use IMAP.",
          "remediation": "Thundermail has no POP service, so this account cannot work as configured. Add the mailbox again as IMAP: Thunderbird app menu ☰ → Add Account → Email (the menu item is called New Account in Thunderbird 149 and earlier). Autoconfiguration should set mail.thundermail.com:993 with Connection security SSL/TLS and Authentication method OAuth2 for incoming mail, and mail.thundermail.com:587 with STARTTLS for outgoing.",
          "provenance": "No POP host or port exists in production config, and the Thundermail UI has no POP tab.",
          "$comment": [
            "The verdict is 'POP isn't supported' rather than 'your POP",
            "settings are wrong'. There are no correct POP settings to offer,",
            "so reporting per-field mismatches here would be nonsense."
          ]
        },

        "jmap": {
          "direction": "incoming",
          "supported": false,
          "verdict": "fail",
          "message": "Thunderbird Desktop can't use JMAP yet.",
          "remediation": "Use IMAP for now: mail.thundermail.com:993, Connection security SSL/TLS, Authentication method OAuth2. JMAP support in Thunderbird Desktop is expected around 2026/2027.",
          "provenance": "Thundermail serves JMAP on mail.thundermail.com:443, but Thunderbird Desktop cannot use it yet.",
          "$comment": [
            "Keyed by protocol so JMAP can be switched to supported later",
            "without restructuring. Reaching this branch means something",
            "unusual, since Thunderbird Desktop cannot create such an account",
            "today -- report it rather than treating it as a parse error."
          ]
        }
      }
    }
  ]
}
