Patch mail gem to handle TLS settings properly
What does this MR do and why?
While https://github.com/mikel/mail/pull/1526 made it possible to disable STARTTLS with Ruby 3, there were a number of logic errors that were fixed in https://github.com/mikel/mail/pull/1536.
We pull in those changes so that existing users don't have to modify
their configurations to omit tls
and ssl
settings to disable
STARTTLS.
Relates to #399241 (closed)
How to set up and validate locally
First, on an Omnibus instance, copy config/initializers/mail_starttls_patch.rb
to /opt/gitlab/embedded/service/gitlab-rails/config/initializers
.
Verify with STARTTLS enabled
- Set up Gmail with GitLab: https://kifarunix.com/configure-gitlab-to-use-gmail-smtp-for-outbound-mails/
- Run
gitlab-rails console
:Notify.test_email('destination_email@address.com', 'Message Subject', 'Message Body').deliver_now
Verify with STARTTLS disabled
- Set up Postfix: https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-postfix-as-a-send-only-smtp-server-on-ubuntu-22-04
- Configure SMTP without SSL: https://docs.gitlab.com/omnibus/settings/smtp.html#smtp-without-ssl
- Run
gitlab-rails console
:Notify.test_email('destination_email@address.com', 'Message Subject', 'Message Body').deliver_now
Messages should be sent successfully in both cases.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Stan Hu