[SOLVED] SMTP settings missing in Gitlab-ce?

We are using Mattermost with the Gitlab-ce installation.
Emails in Gitlab work using an Exchange server with the following settings:

gitlab_rails[‘smtp_enable’] = true
gitlab_rails[‘smtp_address’] = “mail..ch"
gitlab_rails[‘smtp_port’] = 587
gitlab_rails[‘smtp_user_name’] = “git”
gitlab_rails[‘smtp_password’] = "

gitlab_rails[‘smtp_domain’] = “mail.***.ch”
gitlab_rails[‘smtp_authentication’] = “login”
gitlab_rails[‘smtp_enable_starttls_auto’] = true
gitlab_rails[‘smtp_openssl_verify_mode’] = ‘none’

Mattermost is configured as close as possible but doesn’t work.
config:

mattermost[‘email_enable_sign_up_with_email’] = false
mattermost[‘email_enable_sign_in_with_email’] = false
mattermost[‘email_enable_sign_in_with_username’] = false
mattermost[‘email_send_email_notifications’] = true
mattermost[‘email_require_email_verification’] = false
mattermost[‘email_smtp_username’] = “git”
mattermost[‘email_smtp_password’] = “"
mattermost[‘email_smtp_server’] = "mail.
.ch”
mattermost[‘email_smtp_port’] = 587
mattermost[‘email_connection_security’] = “STARTTLS” # tried different things here
mattermost[‘email_feedback_name’] = “"
mattermost[‘email_feedback_email’] = "

Which leads to the following mattermost config.json:

“EnableSignUpWithEmail”: false,
“EnableSignInWithEmail”: false,
“EnableSignInWithUsername”: false,
“SendEmailNotifications”: true,
“RequireEmailVerification”: false,
“FeedbackName”: “",
“FeedbackEmail”: "git@
.ch”,
“FeedbackOrganization”: “”,
“SMTPUsername”: “git”,
“SMTPPassword”: “",
“SMTPServer”: "mail.
.ch”,
“SMTPPort”: “587”,
“ConnectionSecurity”: “”,
“InviteSalt”: “***”,
“SendPushNotifications”: false,
“PushNotificationServer”: “”,
“PushNotificationContents”: “generic”,
“EnableEmailBatching”: false,
“EmailBatchingBufferSize”: 256,
“EmailBatchingInterval”: 30,
“SkipServerCertificateVerification”: false,
“EnableSMTPAuth”: false,
“EmailNotificationContentType”: “full”

First thing we noticed is that ConnectionSecurity is not set (although set in gitlab.rb → mattermost['email_connection_security = “STARTTLS”).
Also EnableSMTP false seems wrong, user and password are provided…
In the admin_console, these settings are the same (accoring to config.json, not gitlab.rb).

In the config.json are fields available that might be needed for our setup, but not int the gitlab.rb:

  • EnableSMTPAuth (= gitlab_rails[‘smtp_authentication’] ?!)
  • SkipServerCertificateVerification (= gitlab_rails[‘smtp_openssl_verify_mode’] ?!)
  • ConnectionSecurity ( = STARTTLS, like gitlab_rails[‘smtp_enable_starttls_auto’] ?!)

The mattermost log shows the following error after setting all the correct setting in admin_console:

2017-09-05_13:29:31.55018 [2017/09/05 15:29:31 CEST] [EROR] /api/v4/email/test:SendMail code=500 rid=u31w4bhee7y8df3pm1yffqy9cw uid=4mfjbwy7478xfqd5bw86ngk7ia ip=*** Failed to authenticate on SMTP server [details: 504 5.7.4 Unrecognized authentication type]

What are we doing wrong?!

Those settings correspond to the following fields in gitlab.rb:

  • EnableSMTPAuth is mattermost['email_smtp_auth']
  • SkipServerCertificateVerification is mattermost['email_skip_server_certificate_verification']
  • ConnectionSecurity is mattermost['email_connection_security']

The corresponding ones for GitLab that you listed sound correct. If there’s any other settings missing from your gitlab.rb, you can see every possible one here.

For the ConnectionSecurity setting not being set properly, that’s very strange. STARTTLS is the correct value for it. Maybe you could try configuring EnableSMTPAuth and SkipServerCertificateVersion, running gitlab-ctl reconfigure, and seeing if ConnectionSecurity is picked up then?

Sorry for crossposting, but I also created an issue yesterday: https://gitlab.com/gitlab-org/gitlab-mattermost/issues/105

Thank you for the suggestions, I will try the settings you provided.
However I think the documentation is definitely lacking if one has to look at the source code for all the configuration options… (The possible values for each setting is even less straigth forward to find out.)

Using the fields you suggested does actually work, at least with a Gmail account.
However the problem with the Exchange account persists.

Would you mind having a look if these settings do look the same for you now compared to the gitlab_rails from above:

mattermost[‘email_feedback_name’] = “"
mattermost[‘email_feedback_email’] = "

mattermost[‘email_smtp_server’] = “mail..ch"
mattermost[‘email_smtp_port’] = 587
mattermost[‘email_smtp_username’] = “git”
mattermost[‘email_smtp_password’] = "

mattermost[‘email_smtp_auth’] = true
mattermost[‘email_connection_security’] = “STARTTLS”
mattermost[‘email_skip_server_certificate_verification’] = true

That looks correct to me. As long as it’s appearing correctly in the config.json as well, I can’t see what the issue would be.

Are there any logs on the Exchange server that might give more information about why Mattermost isn’t connecting?

Unfortunately I don’t have access to the server logs at the moment.
That’s why I instead opted for a Gmail account which works flawlessly.

I might get back to try the Exchange account at a later point, but we’re fine for now.

Thanks for your support

Thanks for your feedback @sborer,

Let us know how it goes once you get back to Exchange