SMTP fail to send email due to SSL wrong version number

Hello,
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('my.email@gmail.com', 'Message Subject', 'Message Body').deliver_now
Notify#test_email: processed outbound mail in 1.1ms
Sent mail to my.email@gmail.com (73.2ms)
Date: Tue, 31 Dec 2019 08:52:16 +0000
From: Gitlab <gitlab@allcare-in.com>
Reply-To: Gitlab <noreply@allcare-in.com>
To: my.email@gmail.com
Message-ID: <5e0b0c4033b98_20263fa00edd99a4493@ubuntu-1804-srv.mail>
Subject: Message Subject
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>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 ex3.mail.ovh.net:587 -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?
regards,

Hi,

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 ex3.mail.ovh.net
Starting Nmap 7.80 ( https://nmap.org ) at 2020-01-02 21:56 CET
Nmap scan report for ex3.mail.ovh.net (178.33.60.184)
Host is up (0.025s latency).
Other addresses for ex3.mail.ovh.net (not scanned): 54.38.249.123 151.80.105.153 5.196.84.189 149.202.213.215 51.68.68.38
rDNS record for 178.33.60.184: indiv3-cas2.ovh.exchange
Not shown: 992 filtered ports
PORT    STATE SERVICE
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 ssl0.ovh.net with the smtps port on 465.

Cheers,
Michael

1 Like