4

One of our datacenters hosts a webapplication written in CFML / Lucee. It sends mails to customers, but the mails have a high X-Barracuda-Spam-Score. Especially on the Message-Id:

pts  rule name              description
2.60 INVALID_MSGID_2        Message-Id is not valid, according to RFC 2822

The message-Id looks like this:

<844275327.4929.1591341519768.JavaMail."LOCAL SERVICE"@servername>

When reading the RFC, it looks like the quotes are the problem.

The question is: is there a way to alter this "LOCAL SERVICE" part? The cfmail tag does not give any control over the Message-Id, nor do I find any setting in Lucee. Lucee uses JavaMail for sending messages.

The specs of out Lucee server are:

Lucee Versio 5.3.5.92
Tomcat 9.0.31
Java 11.0.6
Windows Server 2016 (10) 64 BIT

One of our customers uses Coldfusion 9,0,0,251028. The Message-Id of their mails looks like:

<170351411.4299.1591215728394.JavaMail.ServerName$@mailrelay.company.local>

Thanks!

Roeland
  • 820
  • 1
  • 9
  • 33
  • "LOCAL SERVICE" sounds like the name of a Windows account. Does any of the Lucee Services (not sure if there is more than one) use this account in your setup? – Tomalak Jun 05 '20 at 10:58
  • 4
    ...if that's the case, create a dedicated local account for Lucee (but without spaces in the name!), give it "modify" permissions on the installation directory, use it as the service account, restart the Lucee & try again. – Tomalak Jun 05 '20 at 11:04
  • Hi Tomalak, thanks for your response. It does sound like a Windows account. The service does run under a local service account. But so does the service at the other clients server. Anyway, I will give it a try at our delevelopment server. – Roeland Jun 05 '20 at 11:27
  • 2
    If seems that JavaMail is hard-coded to use the account name of the process that creates the email as part of the message ID. And to use quotes when the account name contains spaces - which probably is the right thing to do as per the spec, but still. – Tomalak Jun 05 '20 at 11:30

1 Answers1

3

The session property mail.from can be used to control the user account name that is encoded in the Message-Id.

If you can't set the from address you can set the session property for mail.user to change the messageid and use the mail.<protocol>.user to switch back to the correct userid.

The session also supports a value of user.name which can be used to change the user name.

Make sure that you are running the latest version of JavaMail as there are some fixes related to this issue. Mainly versions 1.5.3 and newer remove the user name from the message id.

Another option is to subclass MimeMessage to override the messageID computation.

jmehrens
  • 10,580
  • 1
  • 38
  • 47
  • Interesting. Didn't know about mail.from. CFMail is a wrapper, so it doesn't expose all of the javamail properties and features, but assuming it is using the latest javamail, it sounds like changing the user might be an option as well. Not sure what else that impacts though https://stackoverflow.com/a/29656002/8895292 – SOS Jun 05 '20 at 16:00
  • 2
    @Agreax I would go with Tomalak's suggestion of just changing the user account for the process. You should be able to simply upgrade your version of JavaMail to fix the issue as 1.5.3 and later removes the user name from the messageid. – jmehrens Jun 05 '20 at 16:36
  • 1
    Yes, thiinking on it some more that's probably the best option in CF, since the java methods aren't available. Still, it was interesting to find out you could change the user. Will have to research that one more to understand where/how it's used. So good info nonetheless. – SOS Jun 06 '20 at 17:12
  • We have changed the service account and this resolved this issue. I also filed a RFC with the Lucee Dev group (EHIB-29) for upgrading the JavaMail. Thanks for all your swift replies and answers! I accepted the only 'real' answer here and upvoted Tomalaks comments. Both may provide valuable info for others looking for answers on SO. – Roeland Jun 09 '20 at 19:54