You use the cfmailparam
tag to attach files or add a custom header to an e-mail message. You nest the cfmailparam
tag within the cfmail
tag.
You use one cfmailparam
tag for each attachment, as the following example shows:
<cfmail
from="daniel@MyCompany.com"
to="jacob@YourCompany.com"
subject="Requested Files">
Jake,
Here are the files you requested.
Regards,
Dan
<cfmailparam file="c:\widget_launch\photo_01.jpg">
<cfmailparam file="c:\widget_launch\press_release.doc">
</cfmail
>
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.
When the recipient of an e-mail message replies to the message, the reply is sent to the address specified in the From field of the original message. You can use cfmailparam
to override the value in the From field and provide a Reply-To e-mail address. 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
widget_master@YourCompany.com.
See you at Widget World 2002!
Jake
</cfmail>
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.