CFLib.org – Common Function Library Project

CID()

Last updated July 13, 2005

Version: 1 | Requires: ColdFusion MX | Library: UtilityLib

 
Rated 0 time(s). Average Rating: 0

Description:
In order to send inline images with CFMX6.1u1 (or greater), you need to specify a Content ID for the attached image, which needs to be globally unique.

Return Values:
Returns a string.

Example:

view plain print about
<CFSET Img_mx_login=CID()>

<cfmail to="someone@somewhere.com" from="someone@somewhere.com" subject="Mail Test">
<cfmailpart type="text/html" charset="UTF-8">
<html>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%">
  <tr>
    <td bgcolor="003350" align="center">
      <img src="cid:#Img_mx_login#"><br>
      <font face="Arial" size="6" color="white">
      <b>Rocks!</b>
      </font>
    </td>
  </tr>
</table>
</body>
</html>
</cfmailpart>
<cfmailpart type="text/plain" charset="UTF-8">
Your email client sucks.
</cfmailpart>
<cfmailparam file="#Request.RootDir#CFIDE/administrator/images/mx_login.gif"
type="image/gif" contentid="#Img_mx_login#">

</cfmail>

Parameters:

No arguments.

Full UDF Source:

view plain print about
<cfscript>
/**
 * Returns a globally unique Content ID value.
 * 
 * @return Returns a string. 
 * @author John Bartlett (jbartlett@strangejourney.net) 
 * @version 1, July 13, 2005 
 */

function CID() {
  // Create a globally unique identifier
  return lCase(CreateUUID() & "@" & listFirst(cgi.server_name,"."));
}
</cfscript>
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Tayo Akinmade Tayo Akinmade added
arrayTrim
4 day(s) ago

Will Belden Will Belden added
longTime
9 day(s) ago

James Sleeman James Sleeman added
quickSort
19 day(s) ago

Ben Forta Ben Forta added
GetHostAddress
22 day(s) ago

Top Rated

Darwan Leonardo Sitepu EksporSQLData
Rated 5.0, 16 time(s)

Darwan Leonardo Sitepu backupDatabase
Rated 5.0, 13 time(s)

Barney Boisvert indentXml
Rated 5.0, 10 time(s)

Kevin Pepperman generateSsccAsn
Rated 5.0, 4 time(s)

Created by Raymond Camden / Design by Justin Johnson