Bug: Sending an email from a local smtp server (e.g., protonmail) doesn't prompt to add a security exception
Status: RESOLVED
Priority: --
Resolution: FIXED
Created: 2021-03-06 22:14:42+00:00
Resolved: 2021-04-22 12:01:17+00:00

I was trying to set up a protonmail.com account, because I want to migrate email providers and I was trying to test out multiple alternatives.

In order to set up protonmail with Thunderbird, you need to set up a [bridge](https://protonmail.com/bridge/thunderbird) which effectively runs a local imap / smtp server with a self-signed certificate, I think.

When setting up the account following the instructions everything seems to work. But when you get to send the email, stuff fails with a generic "Sending of the message failed."

The error console says:

```
mailnews.smtp: 
error
​
bubbles: false
​
cancelBubble: false
​
cancelable: false
​
composed: false
​
composedTarget: TCPSocket { host: "127.0.0.1", port: 1025, ssl: true, … }
​
currentTarget: null
​
defaultPrevented: false
​
defaultPreventedByChrome: false
​
defaultPreventedByContent: false
​
eventPhase: 0
​
explicitOriginalTarget: TCPSocket { host: "127.0.0.1", port: 1025, ssl: true, … }
​
isReplyEventFromRemoteContent: false
​
isSynthesized: false
​
isTrusted: true
​
isWaitingReplyFromRemoteContent: false
​
message: "SecurityCertificate"
​
multipleActionsPrevented: false
​
name: "SecurityError"
​
originalTarget: TCPSocket { host: "127.0.0.1", port: 1025, ssl: true, … }
​
returnValue: true
​
srcElement: TCPSocket { host: "127.0.0.1", port: 1025, ssl: true, … }
​
target: TCPSocket { host: "127.0.0.1", port: 1025, ssl: true, … }
​
timeStamp: 0
​
type: "error"
​
<get isTrusted()>: function isTrusted()
​
<prototype>: TCPSocketErrorEventPrototype { name: Getter, message: Getter, … }
SmtpClient.jsm:436:17
mailnews.send: Sending failed: Sending of the message failed., exitCode=2147500037, originalMsgURI= MessageSend.jsm:304:27
    fail resource:///modules/MessageSend.jsm:304
    _deliveryExitProcessing resource:///modules/MessageSend.jsm:587
    sendDeliveryCallback resource:///modules/MessageSend.jsm:652
    OnStopRunningUrl resource:///modules/MessageSend.jsm:1229
    onerror resource:///modules/SmtpService.jsm:137
    _onError resource:///modules/SmtpClient.jsm:457
Prompter: internal dialogs not available in this context. Falling back to window prompt. Prompter.jsm:1033
    set modalType resource://gre/modules/Prompter.jsm:1033
    ModalPrompter resource://gre/modules/Prompter.jsm:989
    getPrompt resource://gre/modules/Prompter.jsm:65
    getDefaultPrompt resource:///modules/MessageSend.jsm:285
    fail resource:///modules/MessageSend.jsm:302
    _deliveryExitProcessing resource:///modules/MessageSend.jsm:587
    sendDeliveryCallback resource:///modules/MessageSend.jsm:652
    OnStopRunningUrl resource:///modules/MessageSend.jsm:1229
    onerror resource:///modules/SmtpService.jsm:137
    _onError resource:///modules/SmtpClient.jsm:457
    _onError self-hosted:1173
```

That seems somewhat expected, but there's no way for me to add a security exception from the UI. If I go to preferences and try to manually add an exception for `smtp:///127.0.0.1:1025` it seems to wait forever on the UI while "Attempting to identify this site..."