models.protocols

Class InMemoryProtocol

lucee.Component
    extended by cbmailservices.models.AbstractProtocol
      extended by models.protocols.InMemoryProtocol

Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp www.ortussolutions.com ---- This protocol stores the mail in the `mail` property file.

Class Attributes:
  • singleton
  •  
  • synchronized : false
  •  
  • accessors : true
  •  
  • persistent : false
  •  
  • author : Eric Peterson , Luis Majano
  •  
    Property Summary
    type property default serializable required
    array mail
          This is the mail log for all sent mail.

    • access = public
    • returntype = any
    true false
    Constructor Summary
    init([struct properties='[runtime expression]'])
          Initialize the InMemory protocol.
    Method Summary
    string getMail()
    boolean hasMessage(function callback)
         Check if a given message has been sent by passing in a callback.
    InMemoryProtocol reset()
         Resets the in-memory array.
    struct send(cbmailservices.models.Mail<cbmailservices.models.Mail> payload)
         Store them locally in our maillog property.
    any setMail(array mail)
     
    Methods inherited from class cbmailservices.models.AbstractProtocol
    getLog, getName, getProperties, getProperty, propertyExists, setLog, setName, setProperties, setProperty
     
    Methods inherited from class lucee.Component
    None

    Constructor Detail

    init

    public init([struct properties='[runtime expression]'])

    Initialize the InMemory protocol

    Parameters:
    properties - A map of configuration properties for the protocol

    Property Detail

    mail

    property array mail

    This is the mail log for all sent mail

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    Method Detail

    getMail

    public string getMail()


    hasMessage

    public boolean hasMessage(function callback)

    Check if a given message has been sent by passing in a callback. Each message will be checked against the callback. If one message passes the callback, this method will return true.

    Parameters:
    callback - A callback function to check against each mail item.

    reset

    public InMemoryProtocol reset()

    Resets the in-memory array.


    send

    public struct send(cbmailservices.models.Mail<cbmailservices.models.Mail> payload)

    Store them locally in our maillog property The return is a struct with two keys - `error` - A boolean flag if the message was sent or not - `messages` - An array of error messages the protocol stored if any

    Overrides:
    send in class cbmailservices.models.AbstractProtocol
    Parameters:
    payload - The paylod object to send the message with
    Returns:
    struct of { "error" : boolean, "messages" : [] }

    setMail

    public any setMail(array mail)

    Parameters:
    mail