cfmail attribute "usetls" only works if you supply a username

Description

The following code will not deliver mail using TLS:

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

But this will deliver mail using TLS:

<cfmail from="#from#" to="#to#" subject="Test message" async="false" server="#mailserver#" usetls="true" username="anyStringHere">...

Zac pointed out the problem is likely with line 462 of SMTPClient.java: https://github.com/lucee/Lucee/blob/6.0/core/src/main/java/lucee/runtime/net/smtp/SMTPClient.java#L462

Instead of

props.remove("mail.smtp.starttls.enable");

That line should probably be the same as line 453:

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

Also see https://dev.lucee.org/t/can-only-get-lucee-to-use-tls-when-sending-mail-if-i-provide-a-username-and-password/8887

Environment

any

Activity

Pothys - MitrahSoft 
20 September 2021 at 08:25

 We already have a ticket for this issue https://luceeserver.atlassian.net/browse/LDEV-766 . So I closed this ticket as duplicate and also updates these details in the LDEV-766 description.

Duplicate

Details

Assignee

Reporter

Priority

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Affects versions

Created 16 September 2021 at 16:29
Updated 20 September 2021 at 08:26
Resolved 20 September 2021 at 08:26