SMTP fail to send email due to SSL wrong version number

I’m trying to configure SMTP on standalone Omnibus Gitlab.
But when I try to send an email from the gitlab-rails console I get the following error:

irb(main):003:0> Notify.test_email('', 'Message Subject', 'Message Body').deliver_now
Notify#test_email: processed outbound mail in 1.1ms
Sent mail to (73.2ms)
Date: Tue, 31 Dec 2019 08:52:16 +0000
From: Gitlab <>
Reply-To: Gitlab <>
Message-ID: <5e0b0c4033b98_20263fa00edd99a4493@ubuntu-1804-srv.mail>
Subject: Message Subject
Mime-Version: 1.0
Content-Type: text/
Content-Transfer-Encoding: 7bit
Auto-Submitted: auto-generated
X-Auto-Response-Suppress: All

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "">
<html><body><p>Message Body</p></body></html>
Traceback (most recent call last):
1: from (irb):3
OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 state=error: wrong version number)

I saw this issue which doesn’t help me much unfortunately but when I execute the proposed diagnostic, I get that result:

ubuntuadmin@ubuntu-1804-srv:~$ /opt/gitlab/embedded/bin/openssl s_client -connect -tlsextdebug < /dev/null | grep TLS
140669293283136:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:ssl/record/ssl3_record.c:332:

Could please help me?


CONNECT_CR_SRVR_HELLO:wrong version number says that the port you are trying to connect to, doesn’t serve any TLS. You can test the same with connecting to port 80 for http.

The server you are using doesn’t offer smtps/465, port 587 is just another one for plain smtp.

$ nmap
Starting Nmap 7.80 ( ) at 2020-01-02 21:56 CET
Nmap scan report for (
Host is up (0.025s latency).
Other addresses for (not scanned):
rDNS record for
Not shown: 992 filtered ports
25/tcp  open  smtp
80/tcp  open  http
110/tcp open  pop3
143/tcp open  imap
443/tcp open  https
587/tcp open  submission
993/tcp open  imaps
995/tcp open  pop3s

The server you are looking for is with the smtps port on 465.


1 Like