CFMail in script with ColdFusion 9

by 1:15 AM 5 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

/opt/ColdFusion9/CustomTags/com/adobe/coldfusion

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.

5 comments:

  1. Hey Paul,

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

    params = {};
    params.to = "you@gmail.com";
    params.from = "me@gmail.com";
    params.subject = "Report";
    params.body = "Here is the report you were after";

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

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

    ReplyDelete
  3. @Ryan you can but there is a little more work involved see this post: http://blog.kukiel.net/2011/08/write-dump-in-cfmail-with-cfscript-in.html

    ReplyDelete
  4. SUPR has also helped suppliers put together for a rise in problem gamblers in need of treatment. In State Fiscal Year 2021, 13,037 assessments were carried out by treatment suppliers, representing a 440% increase over the previous 12 months. The vital progress was adopted by a 185% increase over the previous 12 months within the variety of people receiving gambling treatment. IDHS continues to work with gambling suppliers to increase outreach and awareness of the problems that gambling can cause, and to connect impacted folks with the providers that support recovery. IDHS, via SUPR, has funded 26 gambling treatment programs via SFY22.? Twenty-one of 토토사이트 them present outpatient treatment and outreach providers to the communities they serve.

    ReplyDelete