Reputation: 31
I'm using cfmailparam
to attach files to an email. I'm getting the filenames and paths from my database. Normally, the attached files have unique names, but I can get their original filenames by querying the following columns in a database table:
ASSET_FILE_NAME
: unique name ASSET_REAL_NAME
: original_name_before_upload.pdf When I send the e-mail with cfmail, the attachments still use the unique names, but I really need to rename them. I've searched and tried also:
<cfloop from="1" to="#assetfiles.RecordCount#" index="i">
<cfmailparam
file="C:\files\#assetfiles.ASSET_FILE_NAME[i]#"
type="application/pdf"
disposition="attachment; filename=""#assetfiles.ASSET_REAL_NAME[i]#"""
/>
</cfloop>
But this is not working for all attachment files. It changes just 1 filename and the other ones still use the unique names.
Is there anyway to make this possible?
Upvotes: 3
Views: 456
Reputation: 14333
There are a few ways you could do this
remove="true"
attribute of cfmailparam
<cfmailparam file="niceName.pdf" content="#fileRead(oddName.pdf)#">
Upvotes: 4