ColdFusion Muse

Interesting Mail Headers

Mark Kruger October 30, 2008 1:07 PM Coldfusion Tips and Techniques Comments (5)

My good friend Jake Churchill was surfing dev shed and he found this post regarding cfmail. The question is pretty easy, but one of the comments further down caught his eye. A user named mackindlays makes the statement that "Many mail services bounce CF generated mails now". Personally I do not believe there is any evidence that mail servers bounce CF generated mail any more than .NET generated mail or PHP generated mail etc. Perhaps mail servers score mail that is obviously sent from a web server as "more likely to be spam". Certainly that was a contention of my previous post on the subject. At any rate, his solution was to spoof the mail headers for Microsoft Exchange using CFMAILPARAM.

<cfmailparam name="X-MimeOLE" value="Produced By Microsoft Exchange V6.5.7226.0">
<cfmailparam name="X-MS-Has-Attach" value="yes">
<cfmailparam name="X-MS-TNEF-Correlator" value="">
<cfmailparam name="Content-class" value="urn">
<cfmailparam name="content-classes" value="message">
I have no idea if this will work or be successful (I'll let my readers know what I find out). But this rather un-muse like solution is perhaps one more arrow in the quiver of folks trying to send legitimate email.

  • Share:

Solving an Email Send Problem: a Simple, Innovative Approach

Mark Kruger October 22, 2008 6:40 PM Coldfusion Tips and Techniques Comments (7)

Getting email to go through for your customer or newsletter can be tricky these days. An email has to work pretty hard to make it through all the barriers in its way. The problem is compounded when you have an automated email system like a newsletter or marketing apparatus. Even if you follow all the rules you may still achieve a marginal success rate. One of our customers (Tom Long of has a unique system for marketing that is clearly not spam. It involves users sending individual emails out to customers with whom they already have a relationship. It's not bulk email and there are clear opt out instructions. The email goes out in a small trickle of a few hundred an hour. The system tracks the lead internally and an elaborate reporting system allows the user to figure out success rates, run referral programs and keep track of the customer information.

In spite of the benign nature of this system it has still been difficult getting emails out to some domains - particularly large email domains like Yahoo and Hotmail. We have done some innovative things like creating a "scoring" system that utilizes calls to spam assassin to try and "rate" the email before it is sent. The user submits his email text, the system dummies up an email, pipes it to Spam Assassin, retrieves it back and extracts the score - all before the email is sent. Pretty nifty - but not a panacea. In spite of our best efforts the success rate to known good email addresses on larger email domains improved only marginally. This customer is one of those visionary men that simply can't help thinking outside the box. Check out his solution.

Read More
  • Share:

Interesting Loop for Dates and Times

Mark Kruger October 17, 2008 5:59 PM Coldfusion Tips and Techniques Comments (11)

Now my readers know that I've seen enough Coldfusion code in my day that I can quote some livedoc articles verbatim (including the notes and comments). It takes a great deal to surprise me with something new. But here's a snippet I found the other day that made me sit up and take notice. The fact that it uses CFLOOP (one of the most ho-hum of all the CF tags) is even more surprising. This is a loop that iterates over time increments. You can use it to create incremental time objects that are n number of minutes or seconds apart. It doesn't look like you might expect either. Here is an example that loops from 8 to 5 in 45 minute intervals:

Read More
  • Share:

Viewing All Scopes for a Request

Mark Kruger July 29, 2008 7:46 PM Coldfusion Tips and Techniques Comments (11)

This little gem makes me giddy all over - and I don't get giddy easily. There was that one time at a Bette Midler concert in ‘99.... but I digress. Here's a method you may find useful during development, debugging and possibly for error handling. It's a method of the getPageContext() function that returns all scopes available to the request. That would be:

  • Variables
  • Form
  • Cffile
  • cfthread
  • Request
  • Server
  • Http
  • Cgi
  • Client
  • URL
  • Session
  • Cookie
  • File
  • Application
This tag does you a favor in that it guarantees that the scope will be there. So you don't have to "test" for session and then dump out or handle session. It will just show up for you. Here's the code:

Read More
  • Share:

Adding Cfqueryparams to a Legacy Site Without Losing Your Hair

So you got hit with the latest SQLi attack eh? SQLi is the hip acronym for "sql injection" that fancy pants security people use. You've put in some stop gap measures and now you are slogging through 3000 queries trying to add cfqueryparam to everything. It's a laborious task to be sure. Here are some special tips from the muse that might help shorten it.

Read More
  • Share:

Portable ColdfFusion Code (Linux and Windows)

Mark Kruger June 21, 2008 12:35 PM Coldfusion Tips and Techniques Comments (2)

I'm a big fan of ColdFusion on Linux. Not that I know half as much about Linux as I do about Windows. Still, we have a good number of Linux servers here at CF Webtools and CF Linux Guru Ryan Stille keeps them all humming a happy tune. I think both platforms have advantages. If you have ever tried to write ColdFusion code that is able to run on both Linux and Windows you will know there a few differences. One difference is case sensitivity for file names.

On windows if you include a file called "myfile.cfm with a cfinclude that is something like <cfinclude template="myFile.cfm"> it will work just fine. Move the same code to Linux and it will generate a "File Not Found" error because of the capital "F" in your include statement. The good news is that once you fix this problem on Linux you can move it back to Windows and it will now work on both platforms. The other common problem is a bit more challenging. It has to do with file paths.

Read More
  • Share:

Var Scoper Tool

Mark Kruger June 19, 2008 2:55 PM Coldfusion Tips and Techniques Comments (1)

Mike Henke reminded me of this slick little tool called varscoper. Pass in a directory and it will ferret out all the places where variables are not correctly scoped. For example, it will sshow where you have not correctly var'ed variables in a function. The project was produced by Mike Schierberl who's blog has some excellent goodies and tips.

varscoper won't catch the cfhttp scope, but it would catch a variable declared as a result attribute. Either way, it could save you some headaches - especially when dealing with a large pool of code, or taking over someone else's code.

  • Share:

Threads Not Terminating on ColdFusion 8.0.0

Mark Kruger June 17, 2008 7:21 PM Coldfusion Tips and Techniques, Coldfusion 8 Comments (3)

Over the past few days on CF Talk Ian Skinner has been struggling tuning an application that makes use of CFTHREAD. In his application a process spawns threads for creating report files. Ian Reports that the process would spawn the threads, but the threads themselves would neither complete gracefully nor respond to a "terminate" action (<cfthread action="terminate" ...>). No suggestions from the muse or anyone else seemed to help. Finally he upgraded to ColdFusion 8.0.1 and the problem appears to be resolved. Threads complete gracefully without hanging around.

Nothing in the 8.0.1 release notes raises any red flags with me that would indicate why updated to 8.0.1 resolved the issue. I suspect that something very specific about his JVM was causing it. Still, it's nice to know if you run into this ticklish issue there is a way around it.

  • Share: