Smtp problems - outlook.office365.com

In Lucee Admin when I set it up smtp it says its ok and verifies. But I find this in the logs, any ideas? I’m trying to connect to outlook.office365.com

"ERROR","Thread-572","07/31/2018","13:58:59","","mail;Could not connect to SMTP host: smtp-mail.outlook.com, port: 587;lucee.runtime.exp.NativeException: Could not connect to SMTP host: smtp-mail.outlook.com, port: 587
	at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1961)
	at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:654)
	at javax.mail.Service.connect(Service.java:295)
	at lucee.runtime.net.smtp.SMTPSender.run(SMTPSender.java:61)
Caused by: javax.mail.MessagingException: Could not connect to SMTP host: smtp-mail.outlook.com, port: 587;
  nested exception is:
	javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
	... 4 more
Caused by: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
	at sun.security.ssl.InputRecord.handleUnknownRecord(InputRecord.java:710)
	at sun.security.ssl.InputRecord.read(InputRecord.java:527)
	at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:983)
	at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1385)
	at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1413)
	at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1397)
	at com.sun.mail.util.SocketFetcher.configureSSLSocket(SocketFetcher.java:549)
	at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:354)
	at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:211)
	at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1927)
	... 3 more
"

The error message is pretty clear, you have the wrong port?

Hi Zac,

Thank you for replying. I like that you always reply, it’s really awesome of you.

What was unusual to me was that in the lucee admin it verifies with the port and user name/password. Then it throws when you send it. I could have been more clear in what I was saying… I wonder why it verifies in the admin in the 1st place.

I did figure it out, So if you use 365 what you have to do is create a mail “admin exchange center. mail flow.connectors” and specify your IP in the 365 admin. Also, you are right on with ports. The 365 docs say to use port 587 but that won’t work you have to use port 25. And none of it is documented or makes any sense. Oh, how I love Microsoft 365.

2 Likes

Thanks, I enjoy helping out!

did you use the pre-configured outlook mail server template in the admin?

btw, i think outlook uses TLS not SSL, which may explain the Unrecognized SSL message, plaintext connection?

I too can’t get this to work, no matter what I try. Very, very frustrating. Thanks for all the information though!

Use port 25. No tls or ssl. Make sure you set up flow connectors.

If its still not sending, look at your logs and see what/why microsoft is rejecting and that will give you some insight.

I gave up on Office 365. It simply will not allow us to send email via a Lucee server no matter what combination of solutions we try.

However, I did find that for other SMTP servers, the solution was to create the mail service via the Lucee server administrator, not via individual site context. That made all the difference and those other servers work fine.

Whether or not the issue is Office365’s service, Lucee, or something very particular to our server I don’t know. But for now, I am crying uncle.

I appreciate the advice and help!

Brian

When you look a the logs you might find you have to whitelist the IP of your server. I did that, but I don’t know if its necessary, because I found the flow connector after I had did that step ( which I found in the rejection response in the server logs form 365).

Thanks - will have to check it out.

Brian