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

cfmailpart

Specifies one part of a multipart e-mail message. Can only be used in the cfmail tag. You can use more than one cfmailpart tag within a cfmail tag.

Forms tags, Internet Protocol tags

<cfmail 
... >
(Optional cfmailparam entries)
<cfmailpart
type="mime type" charset="character encoding" wraptext="number" > Mail part contents </cfmailpart>
...
</cfmail>

ColdFusion MX 6.1: Added this tag.

cfmail, cfmailparam, cfpop, cfftp, cfhttp, cfldap, cfcontent, Wrap, Sending and Receiving E-Mail in Developing ColdFusion MX Applications

Attribute

Req/Opt

Default

Description

type

Required

 

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

wraptext

Optional

Do not wrap text

Specifies the maximum line length, in characters of the mail text. If a line has more than the specified number of characters, replaces the last white space character, such as a tab or space, preceding the specified position with a line break. If there are no white space characters, inserts a line break at the specified position. A common value for this attribute is 72.

charset

Optional

Character encoding specified by charset attribute of cfmail tag

The character encoding in which the part text is encoded. The following list includes commonly used values::

  • utf-8
  • iso-8859-1
  • windows-1252
  • us-ascii
  • shift_jis
  • iso-2022-jp
  • euc-jp
  • euc-kr
  • iso-2022-kr
  • big5
  • hz-gb-2312
  • euc-cn
  • utf-16

For more information on character encodings, see:
www.w3.org/International/O-charset.html.

Use this tag to create mail messages with alternative versions of the message that duplicate the content in multiple formats. The most common use is to send a plain text version of the message that can be read by all mail readers followed by a version formatted in HTML for display by HTML-compatible mail readers. Specify the simplest version first, with more complex versions afterwards. For more information, see www.ietf.org/rfc/rfc2046.txt.

<h3>cfmailpart Example</h3>

<cfmail from = "peter@domain.com" To = "paul@domain.com" 
Subject = "Which version do you see?"> <cfmailpart
type="text" wraptext="74"> You are reading this message as plain text, because your mail reader does not handle HTML text. </cfmailpart>>
<cfmailpart
type="html"> <h3>HTML Mail Message</h3> <p>You are reading this message as <strong>HTML</strong>.</p> <p>Your mail reader handles HTML text.</p> </cfmailpart> </cfmail>

Contents > CFML Reference > ColdFusion Tags > cfmailpart PreviousNext

ColdFusion 9 | 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


csteinola said on Feb 5, 2004 at 9:49 AM :
We're having trouble getting inline images to work using the CFMAILPART tag in MX 6.1.

Full description of the problem is posted in the forums at
http://webforums.macromedia.com/coldfusion/messageview.cfm?catid=7&threadid=767808

Can CFMAIL be corrected so that it still supports
<cfmailparam name="content-type" value="multipart/alternative; boundary=""----mailboundary----"""> so legacy code that uses it doesn't break, and we can still utilize inline images?
No screen name said on Mar 10, 2004 at 2:43 PM :
I agree... the inability to generate MIME divisions on the fly is proving severely difficult to work around. I'm creating an application where users can query data and then optionally email the data as a CSV file. I've already got the data encoded as CSV in a variable, but there's no way to insert that string into the message as an attachment. I guess the best workaround is to swap it out to a temporary file and attach that, but then I have to work out how to clean those files up later (after spooling is complete).

Really all we need is an option to have cfmailpart use "multipart/mixed" rather than "multipart/alternative". And the ability to add headers (eg. Content-Disposition) within cfmailpart would be very useful.
jrunrandy said on Mar 12, 2004 at 7:21 AM :
This is enhancement 53779, which should be in the next release of ColdFusion.
halL said on Mar 15, 2004 at 8:20 AM :
We have also entered an enhancement request (54608) to add the ability to create MIME divisions on the fly in cfmail.
Request 53779 covers the image isue only.
reinrl said on May 12, 2004 at 7:53 AM :
any clue as to when enhancement 53779 will be released?
Bruce C said on Jun 19, 2004 at 12:50 PM :
Hmmm. So I upgraded to 6.1 to fix undocmented errors with HTTPS using cfhttp and find that I have broken all my nicely crafted cfmail routines - you broke multipart/mixed - all my existing applications that build attachments have to be rebuilt AND you broke my HTML/Text cfmail. Not pleased. Can hardly wait for Monday to see what else is broken!
marcusw1234 said on Dec 20, 2004 at 11:03 PM :
I'm having issues with multipart emails using cfmailpart...

<cfmail from="#sender#" to="#email#" subject="#subject#" failto="#emailfrom#">
<cfmailpart type="html">#html_content#</cfmailpart>
<cfmailpart type="text">#text_content#</cfmailpart>
</cfmail>

This displays the html version fine with Outlook, Outlook express, but can only display the text version with html-enabled email clients like Mozilla Thunderbird, Safari etc.

However, if I just use the plain old cfmail with the type="html" attribute, and NO cfmailpart tags, the above email clients can view the html just fine.

Suggestions?? Known bug??
halL said on Dec 24, 2004 at 12:14 PM :
I have tested sending a multipart mail message using ColdFusion MX 6.1 cfmail, and could read both the HTML and plain text parts in Mozilla Thunderbird 1.0.
Mr.Yuck said on Feb 25, 2005 at 9:01 AM :
In my testing for Mozilla Thunderbird 1.0 putting the HTML mailpart before the TEXT mailpart always shows text, even if you "View message body as original HTML" in the Thunderbird menu.

Order seems to matter, when I specify the TEXT mailpart first, then the HTML mailpart, all is fine.
jon.wolski said on Jan 24, 2007 at 12:59 PM :
It would be useful to know the subtype of multipart mail created by using cfmailpart. Doing command-line IMAP shows that it is multipart/alternative in my particular case. Is this always the case? Is there an algorithm Coldfusion uses to decide the multipart subtype?

 

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-pb3.htm