\Permamail
A wrapper for the core Email class that adds functionality for a few features, including user-defined templates, but most of all captures the send() method call to make a write to the database.
By default, this class is injected to override the core Email class
so that Email::create() can be used in lieu of `new Permamail()`. If
there is a case where Permamail should only be used on certain emails,
you can overload the config to not inject this class into Email and
use Permamail::create() (or `new Permamail()`) instead on a case-by-case
basis.
- Author: Uncle Cheese <unclecheese@leftandmain.com>
Synopsis
class Permamail
extends Email
{
- // members
- protected $userTemplate;
- protected array|SS_List $members;
- // methods
- protected SentEmail persist()
- public Permamail toMembers()
- protected void doSend()
- public void send()
- public void sendPlain()
- public Permamail setUserTemplate()
- public PermamailTemplate getUserTemplate()
- public Permamail parseVariables()
Hierarchy
Extends
Members
protected
- $members
—
array|SS_List
A list of {@link Member} objectsthat will receive the email - $userTemplate
—
string
The identifier of the user-defined template to use
Methods
protected
- doSend() — Sends the a plain or HTML version of the email
- persist() — Persists a {@link SentEmail} record to the database
public
- getUserTemplate() — Gets the {@link PermamailTemplate} by its identifier
- parseVariables() — Overload the Email::parseVariables() method to use a user-defined template
- send() — Sends an HTML email
- sendPlain() — Sends a plain text email
- setUserTemplate() — Sets the user-defined template to use
- toMembers() — Send the email to a list of members