Can only get Lucee to use TLS when sending mail if I provide a username and password

Hi. I can only get Lucee to use TLS when sending emails if I provide a username and password. Does this sound correct? I did not see anything in the docs about this.

For example this delivers mail without using TLS encryption:

<cfmail from="#from#" to="#to#" subject="Test message" async="false"
spoolenable="false" server="#mailserver#" port="#mailport#" usetls="true">...

If I add a username and password, then the email is sent using TLS:

<cfmail from="#from#" to="#to#" subject="Test message" async="false"
spoolenable="false" server="#mailserver#" port="#mailport#" usetls="true"
	username="foo" password="bar">...

The values of the username and password do not matter, because my server does not require authentication.

I can tell when TLS is being used or not because I am proxying the connection through ncat so I can watch the full SMTP session. The server responds with 250 STARTTLS but Lucee never sends STARTTLS unless I provide a username and password in the cfmail tag.

We are running Lucee 5.3.8.201 on Windows.

well, best practise assumes you should always use authentication and it works with a dummy username and password, so is it really a problem?

I don’t agree that it’s best practice to always use authentication. Lots of internal networks use IP allow-lists rather than authentication.

And it took me a long time to figure out why I could not get TLS to work, then on a whim I just decided to try adding a username and password. So in my opinion, yes it’s a problem. Or at least the documentation should explain that in order to use TLS you must provide dummy credentials. Should I enter a ticket for that? I think I’ve done a PR for a documentation change before, I can figure that out again.

feel free to do both :slight_smile:

if you bump up the lucee log level for mail.log or remoteclient.log to debug, is there a stacktrace or log entry when it fails?

update, i think this is the problem

Yes, that line should probably be the same as 453

props.put("mail.smtp.starttls.enable", tls ? "true" : "false");

LDEV-3715 created.