Publish the Configuration and setup the config with the credentials of the different email providers
The configuration of this package allows you to configure the webhooks that have been created on the mandrill control panel.
When enabled and configured, the necessary routes for the web hooks are automatically created and is ready to implement.
The details of enabling and configuring the web hooks are mentioned below.
Lets look at detail the route configurations.
Method | Explanation |
Mandrill($credentials) |
Constructor will initialize the API Key. If no credentials is passed, the credentials will be picked from the config file
Parameter | Type | |
$credentials |
array |
array('apikey'=>'API_KEY_GOES_HERE') |
|
addRecipient($email,$name) |
Adds a Recipient for the Email. Multiple Recipients can be added by calling this function again
|
setHtml($html) |
Sets the HTML Content for the Email
Parameter | Type | |
$html |
string |
<strong>Hi *|user_name|*, This is the body of the message. There is also a global merge tag *|website_url|*</strong> |
|
setText($text) |
Sets the Text Content for the Email
Parameter | Type | |
$text |
string |
This is the Text Content of the message |
|
setSubject($subject) |
Sets the Subject of the Email
Parameter | Type | |
$subject |
string |
This is the subject of the email |
|
setFrom($email, $name) |
Set the Information of the Sender. Calling this function again will override the information if already called
|
setGlobalMergeVariables($key, $value) |
Set the Global merge variables to use for all recipients. Call this function multiple times to add multiple items.
Parameter | Type | |
$key |
string |
website_url |
$value |
string |
http://wwww.google.com |
|
setMergeVariables($recipient, $key, $value) |
Set per-recipient merge variables, which override global merge variables with the same name.
Call this function multiple times to add multiple items.
Parameter | Type | Example |
$recipient |
string |
[email protected] |
$key |
string |
user_name |
$content |
string |
Joh Doe |
|
setGlobalMetadata($key, $value) |
Set user metadata. Mandrill will store this metadata and make it available for retrieval.
In addition, you can select up to 10 metadata fields to index and make searchable using the Mandrill search api.
Parameter | Type | Example |
$key |
string |
INVITE |
$value |
string |
MEMBER |
|
setMetadata($recipient, $key, $value) |
Set Per-recipient metadata that will override the global values specified in the metadata parameter.
Parameter | Type | Example |
$recipient |
string |
[email protected] |
$key |
string |
INVITE |
$value |
string |
US-MEMBER |
|
setReplyTo($email) |
Sets the Reply To Email Address
|
addAttachment($fileName, $mime, $content) |
Adds an Attachment to the Email. Can be called multiple times to add multiple attachments. The content has to be base64encoded
Parameter | Type | Example |
$fileName |
string |
test-file.txt |
$mime |
string |
application/text |
$content |
string |
ZXhhbXBsZSBmaWxl |
|
addImage($fileName, $mime, $content) |
Adds an Image to the Email. Can be called multiple times to add multiple images.
Parameter | Type | Example |
$fileName |
string |
test-file.png |
$mime |
string |
image/png |
$content |
string |
ZXhhbXBsZSBmaWxl |
|
isImportant($value) |
Marking the Email whether or not this message is important, and should be delivered
head of non-important messages. false by default
Parameter | Type | Example |
$value |
boolean |
true |
|
shouldTrackOpens($value) |
Sets whether or not to turn on open tracking for the message. false by default
Parameter | Type | Example |
$value |
boolean |
true |
|
shouldTrackClicks($value) |
Sets whether or not to turn on click tracking for the message. false by default
Parameter | Type | Example |
$value |
boolean |
true |
|
shouldAutoText($value) |
Sets whether or not to automatically generate a text part for messages that are not given text.
false by default
Parameter | Type | Example |
$value |
boolean |
true |
|
shouldAutoHtml($value) |
Sets whether or not to automatically generate an HTML part for messages that are not given HTML.
false by default
Parameter | Type | Example |
$value |
boolean |
true |
|
shouldStripUrlQS($value) |
Sets whether or not to strip the query string from URLs when aggregating tracked URL data.
false by default
Parameter | Type | Example |
$value |
boolean |
true |
|
setInlineCSS($value) |
Sets whether or not to automatically inline all CSS styles provided in the message HTML
- only for HTML documents less than 256KB in size. false by default
Parameter | Type | Example |
$value |
boolean |
true |
|
setBccAddress($value) |
Sets an optional address to receive an exact copy of each recipient's email
|
setTrackingDomain($value) |
Sets a custom domain to use for tracking opens and clicks instead of mandrillapp.com
Parameter | Type | Example |
$value |
string |
john-doe.com |
|
setSigningDomain($value) |
Sets a custom domain to use for SPF/DKIM signing instead of mandrill (for "via" or "on behalf of" in email clients)
Parameter | Type | Example |
$value |
string |
john-doe.com |
|
addTags($value) |
Sets a Tag to the Email. Can be called repeatedly to add multiple tags
Parameter | Type | Example |
$tag |
string |
password-resets |
|
send($timestamp) |
Send a new transactional message through Mandrill. If multiple recipients have been added, they will be show on the `To` field of the Email
If parameter timestamp is specified, then it marks a message to be sent later. If you specify a time in the past, the message will be sent immediately.
An additional fee applies on Mandrill for scheduled email, and this feature is only available to accounts with a positive balance.
Parameter | Type | Example |
$timestamp |
DateTime |
new DateTime('+1 hour') |
|
queue() |
Enables background sending mode that is optimized for bulk sending.
In async mode, messages/send will immediately return a status of "queued" for every recipient.
To handle rejections when sending in async mode, set up a webhook for the 'reject' event.
Defaults to false for messages with no more than 10 recipients;
messages with more than 10 recipients are always sent asynchronously, regardless of the value of async. |
sendBatch($timestamp) |
Sends the email as a batch to Multiple Recipients.
If parameter timestamp is specified, then it marks a message to be sent later.
If you specify a time in the past, the message will be sent immediately.
An additional fee applies on Mandrill for scheduled email, and this feature is only available to accounts with a positive balance.
Parameter | Type | |
$timestamp |
DateTime |
new DateTime('+1 hour'); |
|