SMTP Mail server TLS="Enabled" Still shows "Must issue STARTTLS command first"

Lucee 5.1 trying to set up an SMTP mail server for use with CFMAIL

in Lucee Admin, mail is set up with TLS enabled, SSL disabled and on Port
(Mail is in use by another non-lucee server and it works just fine with
same settings.)

either way, apparently STARTTLS command is never executed. Any
workaround for this? Doesn’t seem as a known issue.

Hopefuly this questions and answers are helpful for somebody in the future:

Lucee is supposed to enable STARTTLS when checking the TLS box in the
administrator’s Mail Server configuarion, sadly it doesnt (At least in my
I solved this with a workaround, since this can also be done in Java with
javamail directly I decided to give it a shot and it worked.

here’s the code

<cfset javaSystem = createObject(“java”, “java.lang.System”) />

<cfset jProps.put(“mail.smtp.starttls.enable”, “true”)>
<cfset jProps.put(“”, “YOUR-MAIL-SERVER-HERE”)>
<cfset jProps.put(“mail.smtp.port”, “587”)>

<cfset msession = createObject(“java”, “javax.mail.Session”)>

mimemsg.setFrom(address); mimemsg.setRecipients(type.TO,"#mailto#"); mimemsg.setSubject("#mailsubject#"); mimemsg.setText("#mailbody#");

<cfset store = m2.getTransport(“smtp”)>

<cfset store.connect()>

store.send(mimemsg); store.close();

I wrote this code and placed it in “sendmail.cfm” file, this way all i
gotta do is replace <cfmail…> tags its a
just remember to declare the mailfrom, mailto, mailsubject & mailbody
variables anywhere before the cfinclude.

Good Luck!

I have been told (and tested it)… The STARTTLS will not be sent from Lucee if user is empty. Even if you are doing an anonymous connection it wont send it.

Using the following code allowed me to send TLS email:
this.mailservers = [{ host: “myhost…”, port: 25, username: ‘dummy’, tls: true, ssl: false }];

adding the username: ‘dummy’ solved the problem.