Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing filename of attachment in CFMail

I'm trying to use ColdFusion to send out emails containing attachments stored on our server.

To manage these attachments we call them 1.jpg, 2.doc ... n.ext where n is a key in a database where we hold other information about the file such as its original filename.

I can use the code:

<cfmailparam file="c:\path\1.doc">

to specify the file, but it is then attached to the email as 1.doc. Is there anyway I can override this and specify my own filename separately from the file?

like image 375
Loftx Avatar asked Apr 23 '09 14:04

Loftx


1 Answers

You can try adding:

<cfmailparam 
file="#actual_file_name#" 
disposition="attachment; filename=""#changed_file_name#""">

The multiple quotes are deliberate... I they allow spaces in the file name.

like image 131
Chris Avatar answered Sep 28 '22 16:09

Chris