SMTP syntax error, unexpected local variable or method, expecting end-of-input

I’ve been config the SMTP via /etc/gitlab/gitlab.rb.

gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = ""
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = ""
gitlab_rails['smtp_password'] = "Hidden"
gitlab_rails['smtp_domain'] = ""
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = false
gitlab_rails['smtp_tls'] = false
gitlab_rails['smtp_pool'] = true

After I reconfigure with gitlab-ctl reconfigure, it shows error output

Error Output

/etc/gitlab/gitlab.rb:92: syntax error, unexpected local variable or method, expecting end-of-input
…ab_rails[‘smtp_domain’] = “

I’ve been following documentation SMTP on Office 365, but none of this works.


Gitlab CE Self-managed v16.9.2

Please kindly help guys, Thank you

I believe that Microsoft disabled the possibility to login using username and password. The only way now that you can configure Office365 is with OAUTH.

Most service providers like Google also are doing the same.

An easier method which I use is just to disable the email configuration options in gitlab.rb and just install and configure something like postfix locally on your server, and then ensure that your domain’s SPF records allow that email address to send emails on behalf of your domain. I haven’t personally attempted to use OAUTH configuration for email delivery with Gitlab, and not sure if it’s possible - the Gitlab documentation most likely will include such examples/possibilities if it’s doable.