Attaches a file or adds a header to an e-mail message.



to = "recipient" 
subject = "message subject" 
from = "sender" 
more attributes... > 
contentID = "content ID" 
disposition = "disposition type"> 
file = "file path"
filename = "name of the file to be sent as attachment"
type ="media type" 


name = "header name" 
value = "header value"> 


You can specify this tag's attributes in an attributeCollection attribute whose value is a structure. Specify the structure name in the attributeCollection attribute and use the tag's attribute names as structure keys.

See also

cfmailcfmailpartcfftpcfhttpcfldapcfpopUsing the cfmailparam tag in Sending and Receiving E-Mail in the Developing ColdFusion Applications


ColdFusion (2016 release) Update 4: Added the attribute decode.

ColdFusion 8.0.1: Added the attributes Content and Remove.

ColdFusion MX 6.x: Added the Disposition and ContentID attributes.

ColdFusion MX 6.1: Added the type attribute.









Lets you send the contents of a ColdFusion variable as an attachment. To do so, specify the variable in # signs as the content attribute value, as in the following example:

<cfmailparam file="anyname" content="#variablename#">





The Identifier for the attached file. This ID must be globally unique and is used to identify the file in an IMG or other tag in the mail body that references the file content.

decode Optional True Decode the name of the file that will be attached to a mail body. When set to false, the file name won't be decoded and will be used as is. See Example 3.




How the attached file is to be handled. Can be one of the following:

  • attachment: presents the file as an attachment.
  • inline: displays the file contents in the message.


Required if you do not specify name attribute


Attaches a file in a message. Mutually exclusive with name attribute. The file is MIME encoded before sending.




Sets the given file name as the attachment file name. If you specify the filename attribute with the name of the attachment, the new name is set as the attachment replacing the name of the attachment in the file location.


Required if you do not specify file attribute


Name of header. Case-insensitive. Mutually exclusive with file attribute.




If yes, ColdFusion removes attachment files (if any) after the mail is successfully delivered.




The MIME media type of the file. Not used with the name attribute. Can be a valid MIME media type or one of the following:

  • text: specifies text/plain type.
  • plain: specifies text/plain type.
  • html: specifies text/html type.
    If you specify the type, the value you specify becomes the content type header; otherwise, ColdFusion generates the content type header.
    Note: For a list of all registered MIME media types, see




Value of the header. Not used with the file attribute.


This tag attaches a file or adds a header to an e-mail message. It can only be used in the cfmail tag. You can use multiple cfmailparam tags within a cfmail tag. You can use this tag to include a file, such as an image, in an HTML mail message. The file can be displayed inline in an HTML message, or as an attachment, as Example 2 shows. To include multiple files, use multiple cfmailparam tags.

Display a file inline in a mail message

  1. Specify type="html" in the cfmail tag.
  2. Specify disposition="inline" and a ContentID attribute in the cfmailparam tag.
  3. Use a src="cid:ContentIDValue" attribute to identify the content to include in the HTML tag such as the img tag.


Example 1: This view-only example uses the cfmailparamtag to add a header to a message, attach files, and to return a receipt to the sender.

<cfmail from = "" To = "" 
Subject = "See Important Attachments and Reply"> 
<cfmailparam name = "Importance" value = "High"> 
Please review the new logo. Tell us what you think. 
<cfmailparam file = "c:\work\readme123.txt" type="text/plain"> 
<cfmailparam file = "c:\work\logo15Jan.gif" type="image/gif">
<cfmailparam filename = "readme.txt">
<cfmailparam filename = "logo.gif">
<cfmailparam name="Disposition-Notification-To" value=""> 

Example 2: This view-only example displays an image in the body of an HTML message.

<cfmail type="HTML" 
to = "#form.mailto#" 
from = "#form.mailFrom#" 
subject = "Sample inline image"> 
<cfmailparam file="C:\Inetpub\wwwroot\web.gif" 
<p>There should be an image here</p> 
<img src="cid:image1"> 
<p>After the picture</p> 

Example 3: Using the decode attribute.

<cfmail to="" from="" subject="Filename with valid html entities">
<cfmailparam file="#expandPath(".")#/test%7c.txt" decode="false">

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy