NSWDPC\Messaging\Mailgun\Connector\Base
Base connector to the Mailgun API Read the Docs at http://mailgun-documentation.readthedocs.io/en/latest/api_reference.html for reference implementations
Synopsis
class Base
{
- // constants
- const API_ENDPOINT_EU = 'https://api.eu.mailgun.net';
- // members
- private static string $api_key = '';
- private static string $api_domain = '';
- private static bool $api_testmode = false;
- private static bool $always_set_sender = true;
- private static string $send_via_job = 'when-attachments';
- private static string $default_recipient = '';
- private static string $webhook_signing_key = '';
- private static string $webhook_filter_variable = '';
- private static bool $webhooks_enabled = true;
- private bool $api_endpoint_url = '';
- // methods
- public static void DateTime()
- public void getClient()
- public void getApiEndpointRegion()
- public void getApiKey()
- public void getWebhookSigningKey()
- public void getWebhookFilterVariable()
- public void getWebhookPreviousFilterVariable()
- public void getWebhooksEnabled()
- public void getApiDomain()
- public void isSandbox()
- protected final void sendViaJob()
- protected final void alwaysSetSender()
- protected final void applyTestMode()
- public final void applyDefaultRecipient()
Hierarchy
Uses
- SilverStripe\Core\Config\Configurable
- SilverStripe\Core\Injector\Injectable
Constants
Name | Value |
---|---|
API_ENDPOINT_EU | 'https://api.eu.mailgun.net' |
Members
private
- $always_set_sender
—
NSWDPC\Messaging\Mailgun\Connector\bool
Always set the sender header to be the same as the From header This assists with removing "on behalf of" in certain email clients - $api_domain
—
string
The Mailgun sending domain - $api_endpoint_url
—
NSWDPC\Messaging\Mailgun\Connector\bool
This is populated in client() and allows tests to check the current API endpoint set - $api_key
—
string
The Mailgun API key or Domain Sending Key (recommended) - $api_testmode
—
NSWDPC\Messaging\Mailgun\Connector\bool
Whether to to enable testmode Mailgun will accept the message but will not send it. This is useful for testing purposes. - $default_recipient
—
string
Mailgun requires a "To" header, if none is provided, messages will go to this recipient Be aware of the privacy implications of setting this value - $send_via_job
—
string
Send message via queued job. Values are 'yes', 'no' and 'when-attachments' - $webhook_filter_variable
—
string
Messages with this variable set will be allowed when a webhook request is made back to the controller Messages without this variable will be ignored This is useful if you use one mailing domain across multiple sites - $webhook_signing_key
—
string
Your webook signing key, provided by Mailgun - $webhooks_enabled
—
NSWDPC\Messaging\Mailgun\Connector\bool
Whether webhooks are enabled or not
Methods
protected
- alwaysSetSender() — When true, the Sender header is always set to the From value. When false, use {@link NSWDPC\Messaging\Mailgun\MailgunMailer::setSender()} to set the Sender header as required
- applyTestMode() — Prior to any send/sendMime action, check config and set testmode if config says so
- sendViaJob() — Whether to send via a queued job or
public
- DateTime() — Returns an RFC2822 datetime in the format accepted by Mailgun
- applyDefaultRecipient() — When Bcc/Cc is provided with no 'To', mailgun rejects the request (400 Bad Request), this method applies the configured default_recipient
- getApiDomain()
- getApiEndpointRegion()
- getApiKey()
- getClient()
- getWebhookFilterVariable()
- getWebhookPreviousFilterVariable()
- getWebhookSigningKey()
- getWebhooksEnabled()
- isSandbox()