View comments | RSS feed
Contents > CFML Reference > ColdFusion Tags > cfmailparam PreviousNext

cfmailparam

Attaches a file or adds a header to an e-mail message. Can only be used in the cfmail tag. You can use more than one cfmailparam tag within a cfmail tag.

Forms tags, Internet Protocol tags

<cfmail 
to = "recipient"
subject = "msg_subject"
from = "sender"
...more attributes... >

<cfmailparam
file = "file-name"
type ="media type">
or
<cfmailparam
name = "header-name"
value = "header-value" >
...
</cfmail>

cfmail, cfmailpart, cfftp, cfhttp, cfldap, cfpop

ColdFusion MX 6.1: Added the type attribute.

Attribute

Req/Opt

Default

Description

file

Required if you do not specify name attribute

 

Attaches file to a message. Mutually exclusive with name attribute. The file is MIME encoded before sending.

type

Optional

 

The MIME media type of the part. 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/

name

Required if you do not specify file attribute

 

Name of header. Case-insensitive. Mutually exclusive with file attribute.

value

Optional

 

Value of the header.

<h3>cfmailparam Example</h3>
<p>This view-only example uses cfmailparam to attach files and add header to
   a message.</p>
<cfmail from = "peter@domain.com" To = "paul@domain.com" 
Subject = "See Important Attachments and Reply"> <cfmailparam name = "Importance" value = "Hich"> 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"> </cfmail>

Contents > CFML Reference > ColdFusion Tags > cfmailparam PreviousNext

ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | Bug Reporting

Version 6.1

Comments are no longer accepted for ColdFusion MX 6.1. ColdFusion 8 is the current version.

Comments


Didgiman said on Feb 16, 2004 at 6:07 AM :
How on earth can I make this piece of code:
<cfmailparam name="Return-Receipt-To" value="#form.mailFrom#">
actually let the receiving server sent a receipt?
Yes, I am using it inside a cfmail tag that works.

Maybe I have to use another procedure? Please tell me!
halL said on Feb 18, 2004 at 11:51 AM :
ColdFusion sends the header.
The SMTP server that gets the message for delivery (not the one that CF is talking to) is responsible for sending the return receipt, but may not.
Didgiman said on Feb 23, 2004 at 5:39 AM :
Why is it then, that when I send a mail with Outlook, and I ask for a delivery receipt, I get the receipt, but when I send a mail to the same email address with ColdFusion, I get nothing?
wlee said on Mar 26, 2004 at 10:29 AM :
We are working to improve the examples in the ColdFusion reference pages. We propose to replace the current example on this page with the the following example. If you have any comments on this example, add them to this page.

<h3>cfmailparam Example</h3>
<p>This view-only example uses cfmailparam to attach files and add header to
a message.</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:\workogo.gif" type="image/gif">
</cfmail>
Bauschj said on Mar 30, 2004 at 12:22 PM :
The example (/6.1/htmldocs/tags-pb2.htm) does not contain a 'return-receipt-requested' param - which is the subject matter being questioned above.
MikeRamsager said on May 20, 2004 at 6:37 AM :
Your documentations on CFMAILPARAM has a type - it says "HICH" instead of "HIGH"... here is the text from the documentation:

<cfmailparam name = "Importance" value = "Hich">
MikeRamsager said on May 20, 2004 at 6:37 AM :
Your documentation on CFMAILPARAM has a typo - it says "HICH" instead of "HIGH"... here is the text from the documentation:

<cfmailparam name = "Importance" value = "Hich">
ddevados said on Jun 2, 2004 at 2:20 PM :
I guess this is kind of similar to question by Didgiman...

I have the following code:
<cfmailparam file="#fileName#">

this gives me a Java.Lang.NullPointerException error. If I hardcode a filename, it works fine. Does CF not like having variables in the cfmailparam? Thanks.
Mettedraq said on Jun 11, 2004 at 10:33 AM :
You might want to check to see if you put the cfoutput tag around your variable.. I forget to do this alot and check for it first thing if I have a variable problem..

<cfoutput>
#variable#
</cfoutput>

>I guess this is kind of similar to question by Didgiman...
>
>I have the following code:
><cfmailparam file="#fileName#">
>
>this gives me a Java.Lang.NullPointerException error. If I hardcode a >filename, it works fine. Does CF not like having variables in the >cfmailparam? Thanks.
Mettedraq said on Jun 14, 2004 at 8:02 AM :
From what I've found out about file attachments on cfmail is that they have to be local.. as in c:\mail_attachment\whatever.ext

I'm using c:\mail_attachment\#variable#
the variable being the filename..
unfortunately I'm reading and writing the files to copy them..
and I'm having a binary file issue or whatever myself.. but I'll figure that out soon enough..
Hutz said on Jun 17, 2004 at 6:10 PM :
Code from 4.5 and up doesn't work in 6.1. We had been building multipart emails using CFMAILPARAM NAME="Content-Type" VALUE="multipart/alternative; boundary=""------------61FAEAC2EB82FEB06690F767""" (or any other boundary)

This now causes a nullpointer error.

Technotes has a note on this citing "Macromedia issue 53723"
http://www.macromedia.com/support/coldfusion/ts/documents/type_cfmailparam.htm

Unfortunately, the posted workaround only works with Outlook and Outlook Express clients (as far as we can tell). Try Netscape, Mozilla, or Mac Mail and the formerly successful emails fail.

With the posted workaround, a second Content-Type header is generated after the one that CF generates automatically. Some clients read the first instance, some read the last. We need to be able to override the default. The inability of some java component to process text makes no sense.

We need a patch or a compliant workaround...
No screen name said on Aug 4, 2004 at 5:45 AM :
Return Receipt Example
=================================================
<html>
<head>
<title>test cfmail - www.gruppotesi.com</title>
</head>

<body>
<h2>Send mail with Disposition-Notification-To -> return receipt</h2>

<cfmail from="reporter@mydomain.com"
to="developer@mydomain.com"
failto="postmaster@mydomain.com"
subject="Disposition-Notification-To">



<!---
header Disposition-Notification-To
--->
<cfmailparam name="Disposition-Notification-To" value="reporter@mydomain.com">

</cfmail>
</body>
</html>
Francisco Mancardi said on Aug 4, 2004 at 5:59 AM :
2.1.44 Disposition-Notification-To: header
Header name:
Disposition-Notification-To
Description:
Mailbox for sending disposition notification
Applicable protocol:
mail (http://www.rfc-editor.org/rfc/rfc2822.txt)
Status:
standards-track
Author/change controller:
IETF (mailto:iesg@ietf.org)
Internet Engineering Task Force.

Specification document(s):
http://www.rfc-editor.org/rfc/rfc2298.txt
Related information:
Indicates that the sender wants a disposition notification when this message is received (read, processed, etc.) by its recipients.
marmot said on Sep 14, 2004 at 6:00 AM :
ColdFusion 6.1 Updater
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Two attributes have been added to the cfmailparam tag to support
mail file attachments:
disposition="disposition-type"
content ID="content ID"
The disposition attribute specifies how the file content is to be
handled. Its value can be inline or attachment. The contentID attribute
specifies the mail content-ID header value and is used as an identifier
for the attached file in an IMG or other tag in the mail body that
references the file content. This ID should be globally unique.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
No screen name said on Nov 1, 2004 at 9:36 PM :
Could you discuss restrictions with the CFMAILPARAM tag in CFMX6.1?

For example:
-A custom MESSAGE-ID seems to be overwritten by the java system, even though it will appear correctly in the mail file in the spool directory.
-Your custom tags can be separated from the other headers by a one line space, causing some email pop readers (including CFPOP!) to believe that these extra parameters are in the body, not the header, if several CFMAILPARAMs are used in a row, with CFIFs around some of them.

Are there other limitations?
No screen name said on Jan 13, 2005 at 8:48 AM :
RE: Hutz said on Jun 17, 2004 at 6:10 PM :

This is still an outstanding issue. There is no way in CF 6.1 to generate a truly multi-part email that is standards compliant (containing both text and html versions of the email). The workaround described in "Macromedia issue 53723" generates a standards-breaking email, which displays incorrectly in most email clients.

It's little niggles like this that prevent CF from competing on a truly enterprise level. Text emails are back in the main stream now that people are receiving them on mobile devices such as blackberries, and all late model email applications block the loading of remote images; if you want the image to appear in the email (standards complaintly, I'm not talking about <cfmailparam file="image.gif"><img src='image.gif'>, which is not compliant and does not work in all email clients), you have to attach it in a multi-part/alternative email, giving it a CID, and referencing the CID in the src attribute.
TomGru said on Jun 21, 2005 at 4:37 AM :
<!--- Script for multiple mail attachmanets --->
<!--- Formfield with the exact ( c:\.....) path to the attachments , delimited if more then one--->
<cfparam name="attach" default="">

<cfmail type="html" to="someone@xyz.com" from="me@xyz.com" subject="xy" >
<!--- loop through formfield and attach the files --->
<cfif #attach# is not "">
<cfset arr = listToArray(attach)>
<cfoutput>
<cfloop from="1" to="#arrayLen(arr)#" index="i">
<cfmailparam file="#arr[i]#">
</cfloop>
</cfoutput>
</cfif>

<!-- Mailtext starts here --->
<cfmail>

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/coldfusion/6.1/htmldocs/tags-pb2.htm