How to use smtp-relay of gmail with tls?
Hi,
I want to setup smtp-relay of gmail with tls.
However, the following error occurred in gitlab-rails console
-------------------------------------------------------------------------------------
GitLab: 11.10.4-ee (88a3c791734)
GitLab Shell: 9.0.0
PostgreSQL: 9.6.11
-------------------------------------------------------------------------------------
Loading production environment (Rails 5.0.7.2)
irb(main):001:0> Notify.test_email('my email address', 'Hello World', 'This is a test message').deliver_now
Notify#test_email: processed outbound mail in 160.0ms
Sent mail to my email address (2220.9ms)
Date: Mon, 20 May 2019 11:49:44 +0900
From: GitLab <gitlab@10.212.160.148>
Reply-To: GitLab <noreply@10.212.160.148>
To: my email address
Message-ID: <5ce215c871c5f_65d33fd2435e06007558d@setup-virtual-machine.mail>
Subject: Hello World
Mime-Version: 1.0
Content-Type: text/html;
charset=UTF-8
Content-Transfer-Encoding: 7bit
Auto-Submitted: auto-generated
X-Auto-Response-Suppress: All
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body><p>This is a test message</p></body></html>
Traceback (most recent call last):
16: from /opt/gitlab/embedded/lib/ruby/gems/2.5.0/gems/actionmailer-5.0.7.2/lib/action_mailer/message_delivery.rb:96:in `block in deliver_now'
15: from /opt/gitlab/embedded/lib/ruby/gems/2.5.0/gems/mail-2.7.1/lib/mail/message.rb:260:in `deliver'
14: from /opt/gitlab/embedded/lib/ruby/gems/2.5.0/gems/actionmailer-5.0.7.2/lib/action_mailer/base.rb:541:in `deliver_mail'
13: from /opt/gitlab/embedded/lib/ruby/gems/2.5.0/gems/activesupport-5.0.7.2/lib/active_support/notifications.rb:164:in `instrument'
12: from /opt/gitlab/embedded/lib/ruby/gems/2.5.0/gems/activesupport-5.0.7.2/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
11: from /opt/gitlab/embedded/lib/ruby/gems/2.5.0/gems/activesupport-5.0.7.2/lib/active_support/notifications.rb:164:in `block in instrument'
10: from /opt/gitlab/embedded/lib/ruby/gems/2.5.0/gems/actionmailer-5.0.7.2/lib/action_mailer/base.rb:543:in `block in deliver_mail'
9: from /opt/gitlab/embedded/lib/ruby/gems/2.5.0/gems/mail-2.7.1/lib/mail/message.rb:260:in `block in deliver'
8: from /opt/gitlab/embedded/lib/ruby/gems/2.5.0/gems/mail-2.7.1/lib/mail/message.rb:2159:in `do_delivery'
7: from /opt/gitlab/embedded/lib/ruby/gems/2.5.0/gems/mail-2.7.1/lib/mail/network/delivery_methods/smtp.rb:100:in `deliver!'
6: from /opt/gitlab/embedded/lib/ruby/gems/2.5.0/gems/mail-2.7.1/lib/mail/network/delivery_methods/smtp.rb:109:in `start_smtp_session'
5: from /opt/gitlab/embedded/lib/ruby/2.5.0/net/smtp.rb:518:in `start'
4: from /opt/gitlab/embedded/lib/ruby/2.5.0/net/smtp.rb:552:in `do_start'
3: from /opt/gitlab/embedded/lib/ruby/2.5.0/net/smtp.rb:584:in `tlsconnect'
2: from /opt/gitlab/embedded/lib/ruby/2.5.0/net/protocol.rb:44:in `ssl_socket_connect'
1: from /opt/gitlab/embedded/lib/ruby/2.5.0/net/protocol.rb:44:in `connect_nonblock'
OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol)
This is the SMTP configuration in /etc/gitlab/gitlab.rb
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "smtp-relay.gmail.com"
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = "mail address"
gitlab_rails['smtp_password'] = "password"
gitlab_rails['smtp_domain'] = "mail domain"
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_enable_starttls_auto'] = true
gitlab_rails['smtp_tls'] = true
gitlab_rails['smtp_openssl_verify_mode'] = 'peer'
Thanks,