Strange SMTP errors
-
Hey Guys, I've had a production system in place for a few years now with no issues. Lately the system hasn't been sending email reports / notifications etc.
I've checked the log and found the following...
WARN 2018-04-09 11:45:43,852 (com.serotonin.m2m2.rt.maint.work.EmailWorkItem.execute:86) - Error sending email org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.MessagingException: Could not connect to SMTP host: in-v3.mailjet.com, port: 465, response: -1. Failed messages: javax.mail.MessagingException: Could not connect to SMTP host: in-v3.mailjet.com, port: 465, response: -1; message exception details (1) are: Failed message 1: javax.mail.MessagingException: Could not connect to SMTP host: in-v3.mailjet.com, port: 465, response: -1
I've tried the other ports such as 25, 587 TLS on/off etc, and all the same errors.
I can ping the hosts, I've also tried just IP Address.
Maybe something is not working with the way Java connects to these hosts?Cheers
Dan -
@dan Definitely just looks like it can't connect, pinging just means the host is up, it doesn't indicate that port 465 is open. Check your SMTP provider hasn't changed their hostname, ports, configuration options etc.
-
I've tried multiple SMTP providers.
Is the SMTP client using a Java library or something you guys wrote? -
the other thing I wondered was, is there a timeout for connection? This connection is now on a satellite link, so latency is <> 800ms
root@water:~# ping in-v3.mailjet.com PING in.mailjet.com (104.199.96.85) 56(84) bytes of data. 64 bytes from 85.96.199.104.bc.googleusercontent.com (104.199.96.85): icmp_seq=1 ttl=41 time=900 ms 64 bytes from 85.96.199.104.bc.googleusercontent.com (104.199.96.85): icmp_seq=2 ttl=41 time=871 ms 64 bytes from 85.96.199.104.bc.googleusercontent.com (104.199.96.85): icmp_seq=3 ttl=41 time=862 ms ^C --- in.mailjet.com ping statistics --- 4 packets transmitted, 3 received, 25% packet loss, time 2998ms rtt min/avg/max/mdev = 862.077/878.014/900.703/16.511 ms root@water:~# telnet in-v3.mailjet.com 465 Trying 104.199.96.85... Connected to in.mailjet.com. Escape character is '^]'.
it appears to connect from shell.
-
one more thing, the SMTP server mailjet uses quite a long password (hash)
Do you know if there is a limit on length of password in the java client? -
@dan said in Strange SMTP errors:
I've tried multiple SMTP providers.
Is the SMTP client using a Java library or something you guys wrote?We use the Spring class
org.springframework.mail.javamail.JavaMailSenderImpl
to send the emails, it is a simple wrapper around the Javajavax.mail.*
interfaces.@dan said in Strange SMTP errors:
the other thing I wondered was, is there a timeout for connection?
We do not set a timeout, it would be the default (according to https://javaee.github.io/javamail/docs/api/com/sun/mail/smtp/package-summary.html that means its infinite).
@dan said in Strange SMTP errors:
it appears to connect from shell.
On the same machine that Mango is running on? Have you checked the firewalls etc?
@dan said in Strange SMTP errors:
Do you know if there is a limit on length of password in the java client?
There is no limit.
Are you using TLS? Maybe its now required or something? What JRE are you using?
-
This is running on one of those MangoES solid state bad boys. It's been super reliable.
root@water:~# java -version java version "1.8.0-ea" Java(TM) SE Runtime Environment (build 1.8.0-ea-b111) Java HotSpot(TM) Client VM (build 25.0-b53, mixed mode)
-
I've even tried using localhost as the mail server and tailed the log...
Apr 11 09:36:04 water postfix/smtpd[9329]: connect from localhost[127.0.0.1] Apr 11 09:36:11 water postfix/smtpd[9329]: lost connection after HELO from localhost[127.0.0.1] Apr 11 09:36:11 water postfix/smtpd[9329]: disconnect from localhost[127.0.0.1]
It appears that the HELO part is failing. This seems to be related to the hostname, I haven't changed this that I'm aware of however :-/
WARN 2018-04-11 09:36:04,555 (com.serotonin.m2m2.rt.maint.work.EmailWorkItem.execute:86) - Error sending email org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.MessagingException: 501 Syntax: HELO hostname . Failed messages: javax.mail.MessagingException: 501 Syntax: HELO hostname ; message exception details (1) are: Failed message 1: javax.mail.MessagingException: 501 Syntax: HELO hostname
-
OK, I think I've resolved it, managed to remove all the settings, add them all in again using port 587, TLS with mailjet and it's working.
Thanks for your assistance :)
Cheers
Dan -
@dan said in Strange SMTP errors:
OK, I think I've resolved it, managed to remove all the settings, add them all in again using port 587, TLS with mailjet and it's working.
Thanks for your assistance :)
Cheers
DanGreat, glad you got it working.