com.sebtools.Mailer
Component Mailer (Mailer)


I handle sending of email notices. The advantage of using Mailer instead of cfmail is that I can be instantiated with information and then passed as an object to a component that sends email, circumventing the need to pass a bunch of email-related information to each component that sends email.


hierarchy: WEB-INF.cftags.component
      com.sebtools.Mailer
properties:
methods: init, addNotice, getDataKeys, getFrom, getNotices, send, sendNotice, startLogging, stopLogging
* - private method

init
public Mailer init ( required string MailServer, required string From, string To="", string username="", string password="" )

I instantiate and return this object.

Output: supressed
Parameters:
   MailServer: string, required, MailServer
   From: string, required, From
   To: string, optional, To
   username: string, optional, username
   password: string, optional, password

addNotice

public void addNotice ( required string name, required string Subject, required string Contents, string To="[runtime expression]", string From="[runtime expression]", string datakeys, string type="text", string CC="", string BCC="", string ReplyTo="", string Attachments="", string html="", string text="", string username="", string password="", string FailTo="", string mailerID="ColdFusion MX Application Server", string wraptext="800" )

I add a notice to the mailer.

Output: supressed
Parameters:
   name: string, required, name
   Subject: string, required, Subject
   Contents: string, required, Contents
   To: string, optional, To
   From: string, optional, From
   datakeys: string, optional, datakeys
   type: string, optional, type
   CC: string, optional, CC
   BCC: string, optional, BCC
   ReplyTo: string, optional, ReplyTo
   Attachments: string, optional, Attachments
   html: string, optional, html
   text: string, optional, text
   username: string, optional, username
   password: string, optional, password
   FailTo: string, optional, FailTo
   mailerID: string, optional, mailerID
   wraptext: string, optional, wraptext

getDataKeys
public string getDataKeys ( required string name )

I get the datakeys for the given email notice. The datakeys are the items that can/should be overridden by incoming data.

Output: supressed
Parameters:
   name: string, required, name

getFrom
public string getFrom ( )

Output: supressed

getNotices
public string getNotices ( )

Output: supressed

send
public boolean send ( required string To, required string Subject, required string Contents, string From="[runtime expression]", string CC="", string BCC="", string ReplyTo="", string Attachments="", string html="", string text="", string username="", string password="", string FailTo="", string mailerID="ColdFusion MX Application Server", string wraptext="800" )

I send an email message and indicate if the send was successful.

Output: supressed
Parameters:
   To: string, required, To
   Subject: string, required, Subject
   Contents: string, required, Contents
   From: string, optional, From
   CC: string, optional, CC
   BCC: string, optional, BCC
   type: string, optional, type
   ReplyTo: string, optional, ReplyTo
   Attachments: string, optional, Attachments
   html: string, optional, html
   text: string, optional, text
   username: string, optional, username
   password: string, optional, password
   FailTo: string, optional, FailTo
   mailerID: string, optional, mailerID
   wraptext: string, optional, wraptext

sendNotice
public void sendNotice ( required string name, struct data )

I send set/override any data based on the data given and send the given notice.

Output: supressed
Parameters:
   name: string, required, name
   data: struct, optional, data

data will have a key for every variable that can be set in notice (any argument of addNotice and anything between [ and ]. Value of said will be replaced with value of key in data struct.
startLogging
public void startLogging ( required any DataMgr )

I make sure that all email sent from Mailer is logged in the mailerLogs table of the datasource managed by the given DataMgr.

Output: supressed
Parameters:
   DataMgr: any, required, DataMgr

stopLogging
public void stopLogging ( )

I stop the logging of email sent from Mailer.

Output: supressed