Cfmailparam overriding User-Agent?

I notice if I add a “User-Agent” header:

<cfmailparam name="User-Agent" value="SomeAgent">

in my cfmail tags it adds an extra User-Agent line to emails sent. So in Lucee it will send both:

User-Agent: Lucee Mail
User-Agent: SomeAgent

same with ACF:

User-Agent: ColdFusion Application Server
User-Agent: SomeAgent

Is there a way to replace (or not send) the built-in User-Agent strings on either server?

By quick checking, I didn’t get user-Agent in the email sent via cfmail. But I can see the X-Mailer: Lucee Mail in the email.

Also, it can override the X-Mailer value using cfmailparam like this

<cfmailparam name="X-Mailer" value="SomeAgent">

Hmm… interesting. I’m still getting two User-Agent lines, even when sending X-Mailer.

Maybe the mail host converts them?

which mail host are you using?

Using Google’s smtp-relay.gmail.com via our company acct.

For a test could you something else?
mailtrap.io does free low-volume accounts.

Then it would at least tell us if there was an issue specific to Google mail.
And of course it still might be a Lucee bug… but the more information the better, of course!

Wow, thanks! Never new about MailTrap - very cool service!

This is with ACF 11, btw. Same thing happens there. Here’s the headers MailTrap received:

Date: Thu, 6 Oct 2022 21:22:14 -0700 (PDT)
From: noreply@myhost.com
To: Dan@myhost.com
Message-ID: <294307258.1011.2665116534192@smtp.mailtrap.io>
Subject: Trying Email Stuff
MIME-Version: 1.0
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 7bit
X-Mailer: ColdFusion 11 Application Server
X-Mailer: Dan's Awesome Emailer

It simply adds a second X-Mailer.

Code used:

<cfmail to="#ThisEmail#" from="noreply@myhost.com" subject="Trying Email Stuff" server="smtp.mailtrap.io" port="25" username="xxx" password="yyy" type="HTML">
<cfmailparam name="X-Mailer" value="Dan's Awesome Emailer">

	<p>Hello!</p>
	
	<p>This was sent to #ThisEmail#</p>
	
	<p>Thank you!</p>
	
	<p>Online Campus<br>System Administrators</p></cfmail>

It must be a CF 11 bug, because running the same Code in Lucee ONLY sends my X-Mailer override. Yay Lucee!

The mailer Id is set in the <cfmail> tag not as a header param…

<cfmail from="" to="" mailerid="Dan">

And there I go again, thinking it had to be a mailparam.

Thanks! I’d forgotten there was an attribute directly in the mail tag.

Solved for CF11 as well!

1 Like

shouldn’t matter, it’s smtp so it’s set by sending program…

you can also use the free Papercut SMTP – The Simple Desktop Email Server on windows as your local smtp server to check email… i’ve used it for 15+ years, and works on win11…

great for behind firewalls also or when you’re devving offline on your laptop or online. (and free)

also X-Mailer is program sending user-agent is client reading the email… so shouldn’t be any user-agents sent with email header.

2 Likes