Attaches a file or adds a header to an e-mail message.
Communications tags, Internet protocol tags
<cfmail to = "recipient
" subject ="message subject
" from = "sender
"more attributes...
> <cfmailparam contentID = "content ID
" disposition = "disposition type
"> file = "filename
" type ="media type
" OR <cfmailparam name = "header name
" value = "header value
"> ... </cfmail>
cfmail, cfmailpart, cfftp, cfhttp, cfldap, cfpop; "Using the cfmailparam tag" in "Sending and Receiving E-Mail" in the ColdFusion Developer's Guide
ColdFusion MX 6.x: Added the Disposition and ContentID attributes.
ColdFusion MX 6.1: Added the type attribute.
Attribute |
Req/Opt |
Default |
Description |
---|---|---|---|
contentID |
Optional |
|
The Identifier for the attached file. This ID should 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. |
disposition |
Optional |
attachment |
How the attached file is to be handled. Can be one of the following:
|
file |
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. |
name |
Required if you do not specify file attribute |
|
Name of header. Case-insensitive. Mutually exclusive with file attribute. |
type |
Optional |
|
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:
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 www.iana.org/assignments/media-types/. |
value |
Optional |
|
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
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 = "peter@domain.com" To = "paul@domain.com" 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\readme.txt" type="text/plain"> <cfmailparam file = "c:\work\logo.gif" type="image/gif"> <cfmailparam name="Disposition-Notification-To" value="peter@domain.com"> </cfmail>
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" disposition="inline" contentID="image1"> <p>There should be an image here</p> <img src="cid:image1"> <p>After the picture</p> </cfmail>