LeKoala\Mandrill\MandrillHelper
This configurable class helps decoupling the api client from SilverStripe
Synopsis
class MandrillHelper
{
- // members
- protected static Mandrill $client;
- private static $domain = NULL;
- private static $siteconfig_domain = NULL;
- private static $log_folder = NULL;
- private static bool $enable_logging = false;
- private static $api_key = NULL;
- private static bool $disable_sending = false;
- // methods
- public static string getLogFolder()
- public static void init()
- public static string|null getAPIKey()
- public static SwiftMailer registerTransport()
- public static Mandrill getClient()
- public static SwiftMailer getMailer()
- public static array listValidDomains()
- public static bool|string getDomain()
- public static bool|string getDomainFromEmail()
- public static string resolveDefaultFromEmail()
- public static string createDefaultEmail()
- public static bool|string getDomainFromHost()
- public static string resolveDefaultToEmail()
- public static bool getLoggingEnabled()
- public static bool getSendingEnabled()
Hierarchy
Uses
- SilverStripe\Core\Config\Configurable
Members
private
- $api_key
—
string
Used to set the mandrill API key if MANDRILL_API_KEY isn't set - $disable_sending
—
LeKoala\Mandrill\bool
Set to true if sending should be disabled. E.g. for testing. - $domain
—
string
Use this to set the app domain registered in mandrill. - $enable_logging
—
LeKoala\Mandrill\bool
Set to true to enable logging. Set to true if MANDRILL_ENABLE_LOGGING env is set. - $log_folder
—
string
Use this to set the logging folder. E.g. _logs/emails. Will be appended to BASE_PATH so must be relative to this. - $siteconfig_domain
—
string
Use this to set the app domain via a siteconfig field. Ignored if $domain is set.
protected
- $client
—
Mandrill
Client instance
Methods
public
- createDefaultEmail() — Create a sensible default address based on domain name
- getAPIKey() — Get api key if enabled
- getClient() — Get the api client instance
- getDomain() — Get domain configured for this application
- getDomainFromEmail() — Get domain from admin email
- getDomainFromHost() — Get domain name from current host
- getLogFolder() — Get the log folder and create it if necessary
- getLoggingEnabled() — Is logging enabled?
- getMailer() — Get the mailer instance
- getSendingEnabled() — Is sending enabled?
- init() — Process environment variable to configure this module
- listValidDomains()
- registerTransport() — Register the transport with the client
- resolveDefaultFromEmail() — Resolve default send from address
- resolveDefaultToEmail() — Resolve default send to address