CFMail in script with ColdFusion 9

by 1:15 AM 3 comments
cfmail is script is easy but as the docs are still a bit lacking and there is no mention of the attributes for using mail in script I had a look in the CF9 install directory and in


You will find the cfc's Adobe made to extend script support. I opened up the mail.cfc and worked out how to use the function. Here is a small example.

Of course to, from, subject etc can be strings they don't have to be variables.

Paul Kukiel


Cras justo odio, dapibus ac facilisis in, egestas eget quam. Curabitur blandit tempus porttitor. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.


  1. Hey Paul,

    You can make it easier to read by using argumentCollection. For example:

    params = {}; = "";
    params.from = "";
    params.subject = "Report";
    params.body = "Here is the report you were after";

    new mail(argumentCollection=params).send();

  2. Is it just me or can you not send complex objects in the body attribute when using mail in script?

  3. @Ryan you can but there is a little more work involved see this post: