Changing the file name in CFMail

I am trying to use ColdFusion to send emails containing attachments stored on our server.

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

I can use the code:

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

to indicate the file, but then it is attached to the letter as 1.doc. Anyway, can I override this and specify my own file name separately from the file?

+3
source share
6 answers

ColdFusion 2016 filename, , .

<cfmail from="john@sample.com" subject="filename test" to="joanna@sample.org" username="john@sample.com" password="password" server="localhost" spoolenable="false">
    <cfmailparam file="c:\Book2.xlsx" filename="Offers.xlsx">
Check out the new offers sheet
</cfmail>

, , Offers.xslx Book2.xslx. https://tracker.adobe.com/#/view/CF-4019518

+1

:

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

... .

+7

, , . CF 8.01, cfmailparam new remove. , cffile cfmailparam, Coldfusion , :

<cfmailparam file="#File_path#" remove="true" />

( 8.01 , , Coldfusion .)

Coldfusion, Java, , . Dan Switzer CF 7.02.

+4

- cffile , . . , , - .

+1

8.0.1 (do cfdump var = "# server #", ), :

  • cfmail cfmailparam remove, ColdFusion .
  • cfmailparam content, ColdFusion . # , : file , ColdFusion.

From:

http://www.adobe.com/support/documentation/en/coldfusion/801/cf801releasenotes.pdf

+1

CF8 : http://www.bennadel.com/blog/1220-coldfusion-cfmailparam-s-new-content-attribute-is-awesome.htm

<cfmailparam
    file="someNiceName.doc"
    content="#fileRead( yourNastyFileName.doc )#"
/>
+1

Source: https://habr.com/ru/post/1706974/


All Articles