User Guide

Table Of Contents
982 Chapter 39: Sending and Receiving E-Mail
You must 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:
1.
Put a cfmailparam tag for each image following the cfmail start tag.
2.
In each cfmailparam tag, 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.
3.
In the location in your HTML where you want the message included, use an img tag 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 email address and change the file
parameter to the path to a valid image.
<cfmail type="HTML"
to = "Peter@myCo.com"
from = "Paul@AnotherCo.com"
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> This text follows the picture</p>
</cfmail>
Adding a custom header to a message
When the recipient of an e-mail message replies to the message, the reply is sent, by default, to the
address specified in the From field of the original message. You can use
cfmailparam to provide a
Reply-To e-mail address that tells the mail client to override the value in the From field. Using
cfmailparam, the reply to the following example is addressed to
widget_master@YourCompany.com:
<cfmail from="jacob@YourCompany.com"
to="daniel@MyCompany.com"
subject="Requested Files">
<cfmailparam name="Reply-To" value="widget_master@YourCompany.com">
Dan,
Thanks very much for the sending the widget press release and graphic.
I’m now the company’s Widget Master and am accepting e-mail at