CFMAILPARAM |
Description Attaches a file or adds a header to an e-mail message.
Category Internet Protocol tags
Syntax
    <cfmail
       to = "recipient"
       subject = "msg_subject"
       from = "sender"
       ...more attributes... >

       <cfmailparam
          file = "file-name"
          type ="media type"
          contentID = "content ID"
          disposition = "disposition type">
       or
       <cfmailparam
          name = "header-name"
           value = "header-value" >
       ...
    </cfmail>
See also cfmail, cfmailpart, cfftp, cfhttp, cfldap, cfpop; "Using the cfmailparam tag" in Chapter 39, "Sending and Receiving E-Mail," in ColdFusion MX Developer's Guide
History ColdFusion MX 6.x: Added the Disposition and ContentID attributes. ColdFusion MX 6.1: Added the type attribute.
Usage 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. To include multiple files, use multiple cfmailparam tags.

To 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.

The second example shows this use.

Example
    <h3>cfmailparam Examples</h3>
    <p>This view-only example uses cfmailparam to 1) add header to a message and 2)
    attach files and 3) to return a receipt to the sender.</p>
    <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>
    <p>This view-only example displays an image in the body of
       an HTML message.</p>
    <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>

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:

- text: specifies text/plain type.
- plain: specifies text/plain type.
- html: specifies text/html type.

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.

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
Default value: "attachment" 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.