download   home   source


craig@cfhero.com's Gravatar   Craig Benner Jan 19, 2010 at 11:38 AM Feb 22, 2012 at 3:40 PM 1.0.1 3.0 Interceptors 2795 712

ColdBox Interceptor - Environment Safe Mail Service

An Interceptor that overrides the mailService to Provide Development Safe MailService

Description

Usage

Adding this intereceptor to your environments.xml.cfm file within coldbox will force coldbox to override the sending of ALL email sent through its MailService to either the 'EmailDebugTOAddress' attribute, or trace it to the coldbox dashboard.

This is the main setup I use with this interceptor

        <Interceptors>
            <!-- USE ENVIRONMENT CONTROL -->
            <Interceptor class="{location of interceptor}.EnvironmentSafeMailService">
                <Property name='EmailTrace'>true</Property>
                <Property name='EmailSend'>false</Property>
                <Property name='EmailOverrideAddress'>me@cfhero.com</Property>
            </Interceptor>
        </Interceptors>

Attributes for Interceptor

  • EmailTrace
    • Values :
      • TRUE
        • Uses the built in logger to trace it to the dashboard
      • FALSE
        • Ignores the tracing feature
  • EmailSend
    • Values :
      • TRUE
        • Uses the EmailOverrideAddress attribute to send the email to (and removes all other recipients).
      • FALSE
        • Ignores sending the email
  • EmailOverrideAddress
    • Valid Email address to send email too.

Installation Instructions

Add interceptor xml to environments.xml.cfm file to enable.

        <Interceptors>
            <!-- USE ENVIRONMENT CONTROL -->
            <Interceptor class="{location of interceptor}.EnvironmentSafeMailService">
                <Property name='EmailTrace'>true</Property>
                <Property name='EmailSend'>false</Property>
                <Property name='EmailOverrideAddress'>me@cfhero.com</Property>
            </Interceptor>
        </Interceptors>

Changelog

Version 1.0.1
  Now accepts 3 properties at configuration to allow simultaneous tracing and sending of the email.

Version 1.0
    First release of code.