cfmailpart order for HTML display in Gmail

It seems that Gmail only renders the HTML part of my multi-part messages from cfmail when the text cfmailpart is before the html cfmailpart.

For example, Gmail will render the text version if I do this:

<cfmail from="#from#" to="#to#" subject="Multi-part, html first">
<cfmailpart type="html"><h1>HTML Message Part</h1></cfmailpart>
<cfmailpart type="text">Text Message Part</cfmailpart>

But if I just swap the order of the cfmailpart entries, then Gmail renders the HTML version:

<cfmail from="#from#" to="#to#" subject="Multi-part, text first">
<cfmailpart type="text">Text Message Part</cfmailpart>
<cfmailpart type="html"><h1>HTML Message Part</h1></cfmailpart>

I had a friend test on Outlook and that client appears to show the HTML part, regardless of the ordering of the text/html parts in the message body. Though I haven't tested any other mail clients yet, I'll keep the text part first and html part second in my multi-part e-mails. I know they'll display as intended in both Gmail and Microsoft Outlook (and I'm guessing most other clients behave like Outlook, in that they'll default to an HTML part if one is there).

cfmail using Gmail SMTP

I wanted to have a cfmail tag use my Gmail SMTP to send mail, which was relatively straightforward, but there is some vague language in the Google help doc that didn't immediately translate to cfmail attribute settings. I did find plenty of search results on the topic, but most threads were a little confusing and noted differing experiences between developers. So I've taken a little time to experiment and thought I'd share the results.

From both my account and my Google Apps for Your Domain mail (gmail for custom domain name) accounts I was able to find the same help doc for standard POP/SMTP configuration.

We can quickly deduce that the username attribute should be your full e-mail address (including or, and the password is of course your Gmail password.

The help doc provides the following information for the outgoing/SMTP server configuration: (use authentication)
Use Authentication: Yes
Use STARTTLS: Yes (some clients call this SSL)
Port: 465 or 587

So, how does the above information translate to relevant cfmail tag attributes (server, port, username, password, useSSL, useTLS)? It's a bit more specific than the Gmail help doc suggests...


ColdFusion round() function bug when operation performed on argument

UPDATE (July 15, 2009): This "bug" still exists in Adobe ColdFusion 9 beta 1. It also seems to behave the same in OpenBD 1.1. This bug does not seem to exist in Railo (I can't reproduce any similar problems in Railo 3.0 or Railo 3.1). For example, round(4.0005*1000) outputs 4000 from both AdobeCF and OpenBD while Railo outputs the expected 4001. There may very well be other scenarios where a floating point representation causes similar unexpected results in Railo as well, but I have not been able to find it yet (nor have I performed an absolutely thorough test, maybe soon if time permits).

Have you ever used a CFML trick like this to round a number to the nearest hundredth?


I have, and I never had a problem, until...

    valueA = 4000.5;
    valueB = 4.0005*1000;
    roundedA = round(valueA);
    roundedB = round(valueB);

You'd be perfectly sane to expect the first two variables to output as 4000.5 and the second two (rounded) to output 4001. Unfortunately, roundedB is output as 4000, not 4001!

This definitely appears to be a bug, but I do have a rather simple workaround...


Hello, [blog] world!

Yes, it was probably at least two years ago when I first thought, "I should start blogging," and here, finally, is my first ever post. Since this will be a blog about ColdFusion development and other programming related topics, I couldn't resist a "hello world" style title for my first post. That said, I'd like to share a little about why I decided to start blogging, what I hope to share and what I hope to gain from blogging.

First, my relevant geek background, in a nutshell:

  • First program written in BASIC on a TRS-80 to calculate my baseball batting average at approximately 10 years old.
  • Geeked out in MS-DOS, C programming and a touch of Perl (1989-1994).
  • Finally made the switch from DOS to Windows 95 in 1996.
  • Entered the University of Rochester as a computer science major -- a little too disinterested in many of the non-programming topics -- graduated with a music degree and a minor in mathematics, but also got a good little dose of data structures, Java and C++.
  • HTML, MS Access and other general computer-related gigs for a couple years (1998-1999).
  • Web development using ASP scripting with MS Access and SQL Server databases (1999-2002).
  • Fell in love with ColdFusion around 2001 (using ColdFusion 4.52 at first) and used it to build and maintain dozens of sites (2001-2003).
  • Really started digging in to object oriented CFML development and helped build, grow and maintain a group of large-scale applications primarily running Mach-II and ColdSpring (with a touch of Transfer, Reactor and Model-Glue) (2004-2008).
  • Read on for present-day geekiness...

In October of 2008 I decided to go solo and freelance develop again to have a better opportunity to code and learn and code and learn (as opposed to management and meetings and management and meetings). I've spent the last few months doing nothing but coding and learning, and I'm loving it! My main project right now is, which I've built up from a blank slate, using ColdFusion 8 Enterprise on Linux, PostgreSQL 8.3, Model-Glue 3 (Gesture, bleeding edge release), ColdSpring, Transfer ORM, MXUnit, jQuery and and I even wrote a little code myself :) I also decided to ditch Microsoft entirely and I'm running Ubuntu 8.04 on my development laptop, along with a Windows XP VM via VirtualBox virtualization to allow for IE testing (will be looking to setup a Mac testing ground as well). This project has helped me ask and answer a lot of questions around good object oriented design, best practices, using the right tools, etc. Though I feel I've had a great sprint of learning over the past few months, I'm hungry to absorb so much more!

That brings me back to my main point, this blog. From many other bloggers I've learned a lot through finding countless answers, great tips, great examples and tutorials, etc. I've also solved a number of problems either on my own or with the help of tid-bits from various online resources. So, I'd like to have a platform to share when I think I have something worth sharing, and that will be this blog. I will also likely blog about some of my own learning experiences, when I think it might help others embarking on a similar learning path. If I'm lucky, some folks might actually read my blog and share some feedback, which will help me and other readers learn more and better ourselves as programmers.

Well, thanks for reading. Cheers to blogging!

BlogCFC was created by Raymond Camden. This blog is running version Contact Blog Owner