Creating an environment safe wrapper for cfmail
The one thing that always makes me nervous when testing other people's code, is who is this going to email? Well many years back I created a cf_email custom tag that wrapped cfmail with some special if logic before it to determine if it was in production or different environment. The logic for is easy comparenoCase(server.serverLevel,"PRODUCTION") EQ 0 and there was another script that got included in the application.cfm file "server.cfm" that loaded the server variables. But the issue I ran into lately, was I needed to use one of the newer features within cfmail that wasn't hard coded into my wrapper. So knowing that coldfusion added the support to attributeCollection=attributes and seeing the Ray Camden had a nice blog post on CFASSOCIATE . I asked one of my co-workers to work on it :-D But anyways, we came up with the below code. The below code allows the same features within coldfusion to be used for within the customTag, but now we can add ...