When I send an email from my Apache JAMES SMTP server to my Gmail address, Gmail receives the email but apparently not via TLS encryption. Gmail shows the show red lock icon saying '[my server] did not encrypt this message.' The email headers also do not indicate receipt via TLS.
I have turned on TLS for my Apache JAMES SMTP server. Here is the relevant part from my smtpserver.xml:
<tls socketTLS="false" startTLS="true">
<keystore>[my-jks-file]</keystore>
<secret>[my-jks-password]</secret>
<provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider>
</tls>
I have also tried using
<tls socketTLS="true" startTLS="false">
instead but it did not fix the problem.
When I try testing my Apache JAMES email address using https://www.checktls.com/TestReceiver the report says everything (including TLS) passed. Testing my server domain using https://mxtoolbox.com/diagnostic.aspx also says TLS passed.
Why are the emails not being encrypted?