Configuring Oracle email develiery with Gitlab self hosted instance

I have self hosted Gitlab Enterprise Edition and configured a third party SMTP server for Gitlab emails. It is working fine. But I am now trying to migrate to Oracle Email Delivery service with the below email configuration:

gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "{{ my smtp address }}"
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = "{{ my smtp username }}"
gitlab_rails['smtp_password'] = "{{ my smtp password }}"
gitlab_rails['smtp_domain'] = "{{ my domain DKIM verifified }}"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
# gitlab_rails['smtp_tls'] = true
# gitlab_rails['smtp_pool'] = false

The reconfiguration is successful, but my email aren’t being delivered. I sent a test email from Gitlab Rails Console and this is the error I received (I have replaced my working email address with a dummy one here).

irb(main):001:0> Notify.test_email('', 'Hello World', 'This is a test message').deliver_now
Delivered mail 6559bdf16c0d4_eecfd2d7897413@gitlab.mail (1172.8ms)
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/net-smtp-0.3.3/lib/net/smtp.rb:1094:in `check_auth_continue': 504 The requested authentication mechanism is not supported (Net::SMTPSyntaxError)

I tried disabling starttls and enabling smtp_tls.

# gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = true

This is the error (replaced ip address with xxx).

Delivered mail 6559c8aff0e5e_efa0d2d78686d0@gitlab.mail (292.0ms)
/opt/gitlab/embedded/lib/ruby/gems/3.0.0/gems/net-protocol-0.1.3/lib/net/protocol.rb:46:in `connect_nonblock': SSL_connect returned=1 errno=0 state=error: wrong version number (OpenSSL::SSL::SSLError)

Changing the port number from 587 to 25 times out the connection (Oracle recommends 587).

Wondering if I can get any help from this community. Please note that the error has to be with the settings since other services that I have Oracle email delivery configured works fine.

The key is to change smtp_authentication to plain instead of login

gitlab_rails['smtp_authentication'] = "plain"

So, after tons of retries. The following is the config that works for me.

gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = ""
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = "smtp cred user"
gitlab_rails['smtp_password'] = "smtp cred password"
gitlab_rails['smtp_domain'] = "register email domain in OCI"
gitlab_rails['smtp_authentication'] = "plain" # change this line to "plain" instead of "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = false
gitlab_rails['smtp_openssl_verify_mode'] = "peer"

gitlab_rails['gitlab_email_enabled'] = true
gitlab_rails['gitlab_email_from'] = '' # must add this email to Approved Senders
gitlab_rails['gitlab_email_reply_to'] = ''
gitlab_rails['gitlab_email_display_name'] = 'ANY NAME'

Oracle now only support port 587 for newly created tenancies. It will show timeout if you use port 25.

Hope it helps.

Never got an email notification for your reply. Hence, this delay in seeing your answer and testing it. It works. Thanks.