-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Rework mailer settings #18982
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rework mailer settings #18982
Conversation
People should be made aware of setting changes, such they will hopefully read the documentation as it could be the case that the behavior of one of those options might change.
Yes the example config file is assumed to be copy-paste ready(with just changing the values).
Seems like a good change, did the old code not even warn about it?
Because of this, It's hard to label this PR, as it it's a refactor + new feature. It could be that this should be splitted into a new PR. Is there a manual overwrite for this heuristic? |
Don't forget to run |
If you'd prefer that, I'd be more than happy to split it. Not 100% sure how you'd want to handle that, though.
Yes; the heuristic is only if the protocol is unspecified. If it's unspecified, it first tries to infer, and if that fails it gives a fatal error.
Nope, the old code just silently went unencrypted if StartTLS wasn't supported, but it did fail if the server claimed to support StartTLS and it failed to start it. |
Not needed for now. |
Been on/off adding fixes to the build, main barrier is updating the SMTP auth source since that also is coupled to this code. Not currently in a big rush since I figure there would still need to be discussion about the changes themselves (outside the code) |
e1f3860
to
a4e475b
Compare
a4e475b
to
cf93a24
Compare
cf93a24
to
d60c438
Compare
CI hasn't completed yet, but the preliminary tests have passed and I believe that everything should be ready now. I updated the PR description to fully break down what this PR does, and deleted the questions that were already answered in previous comments. The one big thing besides what's done here would be updating the docs for configuring emails on the website, but I believe that will require a separate PR. |
Update: the CI seems to pass for everything but testing-arm64/test-pgsql, which looks spurious since this doesn't touch any code that should affect that. I think that things are ready to review. |
5c88b60
to
bc7b454
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
L-G-T-M otherwise.
Thank you for the test, I will fix it. |
cheers! as to how I found out about the issue: I wanted to send a "test email" from the admin page to make sure the new settings work..and it blew up in my face :( EDIT: my bad, |
Thank you both for fixing the issue so quickly! Sorry I didn't test the change thoroughly enough when writing it. |
Hmm, one more bug. The changing of It should be reverted. It's not related to the SMTP config, it's just for the Auth Source. |
Since the require changes for the proposal are small, I figured I would just write the code and offer it, in case less discussion is needed. It's partially me verifying my claim that the proposal wouldn't result in that many code changes, so, I don't mind if I have to rewrite it to account for changes to the proposal. Higher level discussion of the proposal can be found in #18901.
Fix #18901.
Non-breaking changes
mailer.PROTOCOL = smtp+startls
but the server does not support it. It will also log a warning if you usesmtp
on a non-local address, with "local" being either localhost, 127.0.0.1, or ::1; you should usesmtps
orsmtp+startls
instead.mailer.PROTOCOL = smtp+unix
is now supported, as an alternative tomailer.PROTOCOL = smtp
on a local port. This is done by providing a file path toSMTP_ADDR
, which will be the location of the socket to use. If you don't set thePROTOCOL
variable but theSMTP_ADDR
variable has slashes in it, the protocol will be assumed to besmtp+unix
.mailer.PROTOCOL
for different mailers (SMTP family, sendmail, dummy), instead of MAILER_TYPE+PROTOCOL.mailer.HOST
option has been deprecated, in favor of the newmailer.SMTP_ADDR
andmailer.SMTP_PORT
options.mailer.IS_TLS_ENABLED
option has been deprecated in favor of using the newmailer.PROTOCOL
option, which acceptssmtp
,smtps
,smtp+startls
, orsmtp+unix
explicitly. If you don't know what protocol your provider uses but provide a port, you can leave it blank and it will be inferred by the given port. See the non-breaking changes section for more details on the newsmtp+unix
protocol.mailer.DISABLE_HELO
(default false) option has been replaced withmailer.ENABLE_HELO
(default true). It still does the same thing, but the option was negated to be less confusing.mailer.SKIP_VERIFY
option has been replaced withmailer.FORCE_TRUST_SERVER_CERT
to sound scarier, and to clarify what it does.mailer.USE_CERTIFICATE
,mailer.CERT_FILE
, andmailer.KEY_FILE
have been deprecated and renamed tomailer.USE_CLIENT_CERT
,mailer.CLIENT_CERT_FILE
, andmailer.CLIENT_KEY_FILE
.Therevertedgitea admin auth add/update-smtp
command now accepts an--addr
option instead of--host
.