SendGrid-CFML: Wrapper Lib and ColdBox Module

I've released a wrapper library to send email with SendGrid that is also packaged as a ColdBox module. Checkout sendgrid-cfml. It's on ForgeBox too! From inside CommandBox, you can do install sendgrid-cfml and install the module and add it as a dependency to your project in the box.json in one go! I still have to write documentation but there are a few examples for working with it.

I referenced SendGrid's official NodeJS and PHP libraries. It covers everything (I'm pretty sure!) in their Web API. This was a great project to get more comfortable writing tests.

Stuff I've learned from this project:

var system = createObject("java", "java.lang.System");
var env = system.getenv();
var sgUsername = env['SENDGRID_USERNAME'];
this.ramDiskFolder = 'ram:///sendgrid-cfml#GetTickCount()#/';

private string function writeToRamDisk(required string filename, required binary content) {
var ramPath = '#this.ramDiskFolder##arguments.filename#';
    if(not directoryExists(this.ramDiskFolder)){
         directoryCreate(this.ramDiskFolder);
    }
    fileWrite('#this.ramDiskFolder##arguments.filename#', arguments.content);

    return ramPath;
}

Comments

comments powered by Disqus