Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@ntninja
Copy link
Contributor

@ntninja ntninja commented Dec 14, 2025

Replaces #125.

Exposes all the cursed security options I’ve in the past or present seen mail servers require.

This is a slightly breaking change: If the mail server does not support any encryption, one has to now explicitly set email.tlsMode to "none", as the mail client will now refuse to automatically do an insecure downgrade to plaintext if StartTLS is not offered.

Copy link
Member

@BrunoBernardino BrunoBernardino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ntninja this looks very good, but I don't want to ship a breaking change (especially so soon after one), can we come up with a way where that's not necessary?

Additionally, there's no need to change the .env.sample file; email is only used for signup or MFA, nothing else, and I don't plan to use it for anything else.

@ntninja
Copy link
Contributor Author

ntninja commented Dec 15, 2025

Thanks @ntninja this looks very good, but I don't want to ship a breaking change (especially so soon after one), can we come up with a way where that's not necessary?

The only thing, I can think of is adding an additional value to tlsMode called "auto" that for bewCloud v3.x implements the new behaviour suggested here, while the null default retains the previous meaning. We could then emit a warning on startup if people have .email.port set to a value different from 465, but did not set .email.tlsMode.

For bewCloud 4.x null and "auto" will then become equivalent. (I could leave a PR open for that if you want.)

Sounds good enough?

There's no need to change the .env.sample file; email is only used for signup or MFA, nothing else, and I don't plan to use it for anything else.

The previous comment is wrong though: These variables do not (with or without this patch) enable signup email verification or multi-factor authentication via email.

Instead these variables have previously (and still do with this patch) only provided the authentication information when connecting the Mail Submission Agent. Not providing any authentication information is a better default than sending fake:fake as “credentials”.

I forgot to mention this, but without this patch connecting to the Mail Submission Agent is currently broken. This is because nodemailer will attempt PLAIN authentication if any .auth fields are present, but then the PLAIN authentication backend will (correctly) refuse to perform PAIN “authentication” without any credentials (doesn’t make sense and is, to my knowledge, prohibited by RFC).

@BrunoBernardino
Copy link
Member

Sounds good enough?

I might be missing something, but why can't we not allow null, default to auto, and have auto behave as it does now?

The previous comment is wrong though

I suppose you can change enable to use, then.

@ntninja
Copy link
Contributor Author

ntninja commented Dec 15, 2025

Sounds good enough?

I might be missing something, but why can't we not allow null, default to auto, and have auto behave as it does now?

Because null as implemented here, mean “immediate TLS on port 465, required StartTLS otherwise”, while the previous default in bewCloud is “immediate TLS on port 465, opportunistic StartTLS otherwise”.

The proposed mechanism is for “auto” (the new recommended value mentioned in sample config) to mean “immediate TLS on port 465, required StartTLS otherwise”, with the default null retaining the previous bewCloud behaviour of “immediate TLS on port 465, opportunistic StartTLS otherwise”. They can then become one and the same in bewCloud 4.

The null default value is intended is an indefinite stop-gap for backward-compatibility during bewCloud 3 only.

@ntninja
Copy link
Contributor Author

ntninja commented Dec 15, 2025

The previous comment is wrong though

I suppose you can change enable to use, then.

So would this be OK then?

#SMTP_USERNAME=""  # optional, if you want to use signup email verification or multi-factor with an email service requiring authentication
#SMTP_PASSWORD=""  # optional, if you want to use signup email verification or multi-factor with an email service requiring authentication

@ntninja ntninja force-pushed the feat-email-tls-opts branch from e759611 to 471a182 Compare December 15, 2025 16:57
@ntninja
Copy link
Contributor Author

ntninja commented Dec 15, 2025

@BrunoBernardino: Commit 471a182 implements the legacy compatibility behaviour for tlsMode.

@ntninja ntninja force-pushed the feat-email-tls-opts branch from 471a182 to fd83ead Compare December 15, 2025 16:59
Copy link
Member

@BrunoBernardino BrunoBernardino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking great and very close! I have a few minor tweaks and a slight refactor request!

@ntninja ntninja force-pushed the feat-email-tls-opts branch from fd83ead to d880c3a Compare December 17, 2025 21:49
@ntninja ntninja force-pushed the feat-email-tls-opts branch from d880c3a to f680e8d Compare December 17, 2025 21:52
@ntninja
Copy link
Contributor Author

ntninja commented Dec 18, 2025

@BrunoBernardino: Should hopefully be OK now

Copy link
Member

@BrunoBernardino BrunoBernardino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Almost there, I just have a couple more suggestions and questions! Thank you for your patience!

@ntninja ntninja force-pushed the feat-email-tls-opts branch from f680e8d to 428b5a1 Compare December 19, 2025 20:32
@ntninja
Copy link
Contributor Author

ntninja commented Dec 19, 2025

Fixed the multi-line comment

Copy link
Member

@BrunoBernardino BrunoBernardino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes!

@BrunoBernardino BrunoBernardino merged commit d547948 into bewcloud:main Dec 20, 2025
@BrunoBernardino
Copy link
Member

This is live in v3.3.0!

@ntninja ntninja deleted the feat-email-tls-opts branch December 29, 2025 12:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants