STMP email to office365 fails

Hello,

I have Graylog installed on Centos 7 I have setup a stream, an alert from the stream and a notification, however the notification fails with the following error:

2017-09-20T10:38:26.896-04:00 ERROR [EmailAlarmCallback] Alarm callback has email recipients and is triggered, but sending emails failed

org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.office365.com:587

Name        : graylog-server
Arch        : noarch
Version     : 2.3.1
Release     : 1

/etc/graylog/server/server.conf
# Email transport
transport_email_enabled = true
transport_email_hostname = smtp.office365.com
transport_email_port = 587
transport_email_use_auth = true
transport_email_use_tls = true
transport_email_use_ssl = false
transport_email_auth_username = <correct_email>
transport_email_auth_password = <correct_pwd>
transport_email_subject_prefix = [graylog]
transport_email_from_email = <correct_email>

Any help would would be appreciated

I also tried to send using SendGrid and I am getting the same error so I am guessing it could be the configuraton

The Graylog server encountered an error while trying to send an email. This is the detailed error message: org.apache.commons.mail.EmailException: Sending the email to the following server failed : smtp.sendgrid.net:587 (com.sun.mail.util.MailConnectException: Couldn’t connect to host, port: smtp.sendgrid.net, 587; timeout 60000; nested exception is: java.net.SocketTimeoutException: connect timed out)

here is the log for the connection error:

Caused by: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.sendgrid.net, 587; timeout 60000
        at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2053) ~[graylog.jar:?]
        at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:697) ~[graylog.jar:?]
        at javax.mail.Service.connect(Service.java:386) ~[graylog.jar:?]
        at javax.mail.Service.connect(Service.java:245) ~[graylog.jar:?]
        at javax.mail.Service.connect(Service.java:194) ~[graylog.jar:?]
        at javax.mail.Transport.send0(Transport.java:253) ~[graylog.jar:?]
        at javax.mail.Transport.send(Transport.java:124) ~[graylog.jar:?]
        at org.apache.commons.mail.Email.sendMimeMessage(Email.java:1411) ~[graylog.jar:?]
        ... 33 more
Caused by: java.net.SocketTimeoutException: connect timed out
        at java.net.PlainSocketImpl.socketConnect(Native Method) ~[?:1.8.0_144]
        at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) ~[?:1.8.0_144]
        at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) ~[?:1.8.0_144]
        at java.net.AbstractPlainSocketImpl.connect(Unknown Source) ~[?:1.8.0_144]
        at java.net.SocksSocketImpl.connect(Unknown Source) ~[?:1.8.0_144]
        at java.net.Socket.connect(Unknown Source) ~[?:1.8.0_144]
        at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:310) ~[graylog.jar:?]
        at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:236) ~[graylog.jar:?]
        at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2019) ~[graylog.jar:?]
        at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:697) ~[graylog.jar:?]
        at javax.mail.Service.connect(Service.java:386) ~[graylog.jar:?]
        at javax.mail.Service.connect(Service.java:245) ~[graylog.jar:?]
        at javax.mail.Service.connect(Service.java:194) ~[graylog.jar:?]
        at javax.mail.Transport.send0(Transport.java:253) ~[graylog.jar:?]
        at javax.mail.Transport.send(Transport.java:124) ~[graylog.jar:?]

Are you able to access smtp.sendgrid.net:587 from the system running Graylog? You can test this with netcat:

# echo 'QUIT'|nc smtp.sendgrid.net 587
220 SG ESMTP service ready at ismtpd0001p1lon1.sendgrid.net
221 See you later
1 Like

Thanks for the reply. I am getting
Ncat: Connection timed out.
which is strange this VM is on a very permissive network CENTOS firewall is off and even when I turn off selinux it does not work.

Maybe your network administrators or ISP block access to port 25/tcp and 587/tcp.

In the end you have to find out why access isn’t possible to the SMTP server(s) of SendGrid, but Graylog isn’t the culprit in this case. :wink:

1 Like

Yes, it turns out the ISP blocks it for past issues we have had with email blast sent out from within the network.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.