You use the cfmailparam tag to include files in your message or add a custom header to an e-mail message. You can send files as attachments or display them inline in the message. You nest the cfmailparam tag within the cfmail tag.
Attaching files to a message
You can use one cfmailparam tag for each attachment, as the following example shows:
to="jacob@YourCompany.com" |
Use a fully qualified system path for the file attribute of cfmailparam. The file must be located on a drive on the ColdFusion server machine (or a location on the local network), not the browser machine.
Including images in a message
You can use the cfmailparam to include images from other files in an HTML message, as follows:
- Place a cfmailparam tag for each image following the cfmail start tag.
- In each cfmailparamtag, do the following
- Set the file attribute to the location of the image.
- Specify disposition="inline"
- Set the contentID attribute to a unique identifier; for example, myImage1.
In the location in your HTML where you want the message included, use an imgtag such as the following:
<img src="cid:myImage1">
The following example shows a simple mail message with an inline image. In this case, the image is located between paragraphs, but you could include it directly inline with the text. To test this example, replace the cfmail to parameter with a valid e-mail address and change the file parameter to the path to a valid image.
to = "Peter@myCo.com" |
Send e-mail with importance set to high
You can use the cfmailparam tag to set the importance of the message as high, which will show up in, for example, Microsoft Outlook as a red exclamation mark, and a different indicator in other mail clients. Using cfmailparam, the reply to the following example is addressed to widget_master@YourCompany.com:
to="daniel@MyCompany.com" Dan, |
Note: You can combine the two uses of cfmailparam within the same ColdFusion page. Write a separate cfmailparam tag for each header and for each attached file. |