FlowFuse / flowfuse

Connect, collect, transform, visualise, and interact with your Industrial Data in a single platform. Use FlowFuse to manage, scale and secure your Node-RED solutions.
https://flowfuse.com
Other
279 stars 63 forks source link

SMTP using office 365 not working #2933

Closed hyamanieu closed 1 year ago

hyamanieu commented 1 year ago

Current Behavior

Setting up an email configuration using office 365 does not work.

Upon starting the forge container, this comes into the log:

ERROR: Failed to verify email connection: Error: 140715453479728:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:331:

Although my email configuration has debug set to True, I don't get much more info.

email:
  enabled: true
  debug: true
  smtp:
    host: smtp.office365.com
    port: 587
    secure: true
    auth:
        user: <office-account>
        pass: <password>

The issue comes from forge as other application used to send emails (including the Node-Red node to do so) work.

Is the issue that only SSL instead of TLS can be used? I don't have more clues.

Expected Behavior

We can set an email to most major professional email providers, including Microsoft.

Steps To Reproduce

Environment

NAME="Ubuntu" VERSION="20.04.5 LTS (Focal Fossa)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 20.04.5 LTS" VERSION_ID="20.04" HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" VERSION_CODENAME=focal UBUNTU_CODENAME=focal

docker version

Client: Docker Engine - Community Version: 20.10.22 API version: 1.41 Go version: go1.18.9 Git commit: 3a2c30b Built: Thu Dec 15 22:28:08 2022 OS/Arch: linux/amd64 Context: default Experimental: true

Server: Docker Engine - Community Engine: Version: 20.10.22 API version: 1.41 (minimum version 1.12) Go version: go1.18.9 Git commit: 42c8b31 Built: Thu Dec 15 22:25:58 2022 OS/Arch: linux/amd64 Experimental: false containerd: Version: 1.6.15 GitCommit: 5b842e528e99d4d4c1686467debf2bd4b88ecd86 runc: Version: 1.1.4 GitCommit: v1.1.4-0-g5fd4c4d docker-init: Version: 0.19.0 GitCommit: de40ad0

Have you provided an initial effort estimate for this issue?

I am not a FlowForge team member

hardillb commented 1 year ago

Hi,

Can you try the following settings please:

email:
  enabled: true
  debug: true
  smtp:
    host: smtp.office365.com,
    secure: false
    tls:
      ciphers: "SSLv3",
      rejectUnauthorized: false
    auth:
      user: <username>
      pass: <password>

But it also appears that Microsoft may be planning to disable SMTP access for Office365 so if those options don't work then we may need to look at supporting the new nodemailer transport (https://github.com/nodemailer/nodemailer/issues/1485)

hardillb commented 1 year ago

And just a note the debug: true in this case is a setting for FF to output email to the logs to allow testing without a configured email server, it does not change the debug status of the underlying nodemailer library. IIRC email.smtp.debug=true would

hyamanieu commented 1 year ago

I have no error! It seems to work. Thanks :) It must really be documented, I was expecting this here: https://flowfuse.com/docs/install/email_providers/

Or in an area where every option within the flowforge.yml file is described. Perhaps I've missed it?

hardillb commented 1 year ago

I've opened a PR for the docs