Build Status

#WELCOME TO THE COLDBOX MAILSERVICES MODULE

The ColdBox Mail services module will allow you to send email the OO way in multiple protocols for many environments. The supported protocols are:

  • CFMail - Traditional cfmail sending
  • Files - Write emails to disk
  • Postmark API - Send via the PostMark Service (https://postmarkapp.com/)

You can easily add your own mail protocols by building upon our standards.

##LICENSE Apache License, Version 2.0.

##IMPORTANT LINKS

  • https://github.com/coldbox-modules/cbox-mailservices
  • http://forgebox.io/view/cbmailservices
  • Changelog

##SYSTEM REQUIREMENTS

  • Lucee 4.5+
  • ColdFusion 10+

INSTRUCTIONS

Just drop into your modules folder or use the box-cli to install

box install cbmailservices

The mail services registers all mail components so you can use them in your application.

Settings

You will need to update the your ColdBox.cfc with a mailsettings structure with your preferred mail settings and mail protocol to use. All the keys that can go into the mailsettings struct map 1-1 to the cfmail tag except for the tokenMarker and protocol keys.

mailsettings = {
    // The default token Marker Symbol
    tokenMarker = "@",
    // protocol
    protocol = {
        class = "",
        properties = {}
    }
};

Models

This will register a [email protected] in WireBox that you can leverage for usage.

// build mail and send
var oMail = getInstance( "[email protected]" )
    .newMail( to="[email protected]",
              subject="Mail Services Rock",
              bodyTokens={ user="Luis", product="ColdBox", link=event.buildLink( 'home' )} );

// Set a Body
oMail.setBody("
    <p>Dear @[email protected],</p>
    <p>Thank you for downloading @[email protected], have a great day!</p>
    <p><a href='@[email protected]'>@[email protected]</a></p> 
");

//send it
var results = mailService.send( oMail );

Mail Additional Info

The Mail object has some additional methods to allow you to pass additional information so protocols can leverage them:

setAdditionalInfo( struct );
getAdditionalInfo();

setAdditionalInfoItem( key, value );
getAdditionalInfoItem( key );

Mail Protocols

The mail services can send mail via different protocols. The available protocols are:

  • CFMailProtocol
  • FileProtocol
  • PostmarkProtocol

You register the protocols in the mailsettings via the protocol structure:

// FileProtocol
protocol = {
    class = "cbmailservices.models.protocols.FileProtocol",
    properties = {
        filePath = "logs",
        autoExpand = true
    }
}

// PostMark
protocol = {
    class = "cbmailservices.models.protocols.PostmarkProtocol",
    properties = {
        APIKey = ""
    }
}

Custom Protocols

In order to create your own custom protocol you will create a CFC that inherits from cbmailservices.models.AbstractProtocol and make sure you implement the init() and send() method.


Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp www.ortussolutions.com


HONOR GOES TO GOD ABOVE ALL

Because of His grace, this project exists. If you don't like this, then don't read it, its not for you.

"Therefore being justified by faith, we have peace with God through our Lord Jesus Christ: By whom also we have access by faith into this grace wherein we stand, and rejoice in hope of the glory of God. And not only so, but we glory in tribulations also: knowing that tribulation worketh patience; And patience, experience; and experience, hope: And hope maketh not ashamed; because the love of God is shed abroad in our hearts by the Holy Ghost which is given unto us. ." Romans 5:5

THE DAILY BREAD

"I am the way, and the truth, and the life; no one comes to the Father, but by me (JESUS)" Jn 14:1-12

CHANGELOG

1.4.2

  • Fixes incorrect argument collection nesting on protocol registration

1.4.1

  • Auto create folder paths in FileProtocol if they do not exist

1.4.0

  • Updated to use module templating
  • Proposed additionalInfo data struct for provider specific implementations. Added a couple of helper methods : https://github.com/coldbox-modules/cbox-mailservices/pull/5
  • Updated to leverage WireBox for object creations instead of internal new and createobjects

1.3.0

  • Fix on date formatting on file protocol thanks to @elpete
  • Fix for type inclusion on the file protocol thanks to @elpete

1.2.0

  • Travis integration
  • DocBox updates
  • Build process updates

1.1.0

  • Updated build process
  • Updated readme and instructions

1.0.0

  • Create first module version

 

 
$ box install cbmailservices
No collaborators yet.
  • Apr 30 2014 08:24 PM
  • Aug 14 2018 02:47 PM
  • 2922
  • 1620
  • 17302