Cannot mail from google compute server using monit v5.22 and sendgrid

Issue #618 closed
Gerard Moroney created an issue

1 Create VM in Google Compute

2 Compile and Install monit v5.22 on centos-release-6-6.el6.centos.12.2.x86_64 server

3 Add following to /etc/monitrc

set mailserver smtp.sendgrid.net port 2525 username "apikey" password "<key>" using TLSV1 with timeout 30 seconds

4 Start monit

5 Following errors seen in /var/log/monit.log

[UTC Jun 6 08:34:32] error : Cannot create socket to [smtp.sendgrid.net]:2525 -- SSL connection error: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol

[UTC Jun 6 08:34:32] error : Cannot open a connection to the mailserver smtp.sendgrid.net:2525 -- Success

[UTC Jun 6 08:34:32] error : Mail: Delivery failed -- no mail server is available

[UTC Jun 6 08:34:32] error : Aborting event

  • I used nc command to check port is open

  • I confirmed with Google that port 2525 should be used for outbound smtp

Comments (7)

  1. Tildeslash repo owner

    The "using TLSv1" option forces the communication to TLSv1 (connection with SSL handshake), but the "smtp.sendgrid.net" is not SSL/TLS port ... it provides plaintext SMTP service and the client can use STARTTLS to switch to SSL, so the SSL connection ends up with "SSL23_GET_SERVER_HELLO:unknown protocol" (the server doesn't speak SSL):

    $ telnet smtp.sendgrid.net 2525
    Trying 159.122.224.196...
    Connected to smtp.sendgrid.net.
    Escape character is '^]'.
    220 SG ESMTP service ready at ismtpd0004p1lon1.sendgrid.net
    

    The "using TLSv1" option should be removed from monit configuration.

  2. Gerard Moroney reporter

    changed configuration as follows:

    set mailserver smtp.sendgrid.net port 2525 username "apikey" password "<key>" using STARTTLS with timeout 30 seconds

    It works

    Issue can be closed. Please excuse my silliness

  3. Log in to comment