PHPackages                             abishekrsrikaanth/mailto - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. abishekrsrikaanth/mailto

ActiveLibrary[Mail &amp; Notifications](/categories/mail)

abishekrsrikaanth/mailto
========================

Laravel 4 Package to integrate with multiple Cloud Email Providers

1.2(12y ago)215033[1 issues](https://github.com/abishekrsrikaanth/mailto/issues)BSD-3-ClausePHPPHP &gt;=5.3.0

Since Aug 5Pushed 12y ago2 watchersCompare

[ Source](https://github.com/abishekrsrikaanth/mailto)[ Packagist](https://packagist.org/packages/abishekrsrikaanth/mailto)[ Docs](https://github.com/abishekrsrikaanth/mailto/)[ RSS](/packages/abishekrsrikaanth-mailto/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (2)Versions (6)Used By (0)

\####Email Providers Supported

- [Installation](#install)
- [Mandrill](https://www.mandrillapp.com) - ([Documentation](#mandrill))
    - [Sending Email using Mandrill](#send-mandrill)
    - [Queuing Email using Mandrill](#queue-mandrill)
    - [Sending Email at a given Time](#send-mandrill-time)
    - [Sending Email to a Batch of recipients](#send-mandrill-batch)
    - [Sending Email to a Batch of recipients at a given time](#send-mandrill-batch-time)
    - [Passing the credentials dynamically for Mandrill](#credentials-mandrill)
    - [Managing Webhooks](#mandrill-webhooks)
    - [Methods](#methods-mandrill)
- [PostmarkApp](http://www.postmarkapp.com)
    - [Sending Email using PostMark](#send-postmark)
    - [Sending Batch Emails using PostMark](#send-postmark-batch)

\###InstallationAdd abishekrsrikaanth/mailto as a requirement to composer.json:

```
{
    ...
    "require": {
        ...
        "abishekrsrikaanth/mailto": "1.*"
        ...
    },
}

```

Update composer:

```
$ php composer.phar update

```

Add the provider to your app/config/app.php:

```
'providers' => array(
    ...
    'Abishekrsrikaanth\Mailto\MailtoServiceProvider',
),

```

and the Facade info on app/config/app.php

```
'aliases'   => array(
    ...
	'MailTo'      => 'Abishekrsrikaanth\Mailto\Facades\Mailto',
),

```

Publish the Configuration and setup the config with the credentials of the different email providers

```
php artisan config:publish abishekrsrikaanth/mailto

```

\###Mandrill \#####Sending Email using Mandrill

```
$mandrill = MailTo::Mandrill();
$mandrill->addRecipient($email, $name)
         ->setFrom($email, $name)
         ->setHtml($html)
         ->setText($text)
         ->setSubject($subject)
         ->send();

```

\#####Queuing Email using Mandrill

```
$mandrill = MailTo::Mandrill();
$mandrill->addRecipient($email, $name)
         ->setFrom($email, $name)
         ->setHtml($html)
         ->setText($text)
         ->setSubject($subject)
         ->queue();

```

\#####Sending Email at a given Time

```
$timestamp = new DateTime('+1 hour');

$mandrill = MailTo::Mandrill();
$mandrill->addRecipient($email, $name)
         ->setFrom($email, $name)
         ->setHtml($html)
         ->setText($text)
         ->setSubject($subject)
         ->send($timestamp);

```

\#####Sending Email to a Batch of recipients

```
$mandrill = MailTo::Mandrill();
$mandrill->addRecipient($email, $name)
         ->setFrom($email, $name)
         ->setHtml($html)
         ->setText($text)
         ->setSubject($subject)
         ->sendBatch();

```

\#####Sending Email to a Batch of recipients at a given time

```
$timestamp = new DateTime('+1 hour');

$mandrill = MailTo::Mandrill();
$mandrill->addRecipient($email, $name)
         ->setFrom($email, $name)
         ->setHtml($html)
         ->setText($text)
         ->setSubject($subject)
         ->sendBatch($timestamp);

```

\#####Passing the credentials dynamically for Mandrill

```
$mandrill = MailTo::Mandrill(array('apikey'=>'MADRILL_API_KEY'));
$mandrill->addRecipient($email, $name)
         ->setFrom($email, $name)
         ->setHtml($html)
         ->setText($text)
         ->setSubject($subject)
         ->send();

```

\#####Example Response from Mandrill - Success

```
[
    {
        "email": "recipient.email@example.com",
        "status": "sent",
        "reject_reason": "hard-bounce",
        "_id": "abc123abc123abc123abc123abc123"
    }
]

```

\#####Example Response from Mandrill - Error

```
{
    "status": "error",
    "code": 10,
    "name": "PaymentRequired",
    "message": "This feature is only available for accounts with a positive balance."
}

```

\#####Managing WebhooksThe 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.

```
'mandrill' => array(
		'apikey'    => 'MANDRILL_API_TOKEN',
		'web_hooks' => array(
			'enabled' => false,
			'routes'  => array(
				array(
					'route_url'   => '/mandrill/send',
					'route_types' => array('send'),
					'webhook_key' => 'API_WEBHOOK_KEY',
					'listener'    => array(
						'type' => 'event',
						'name' => ''
					),
					'verify_hook' => false
				),
				array(
					'route_url'   => '/mandrill/bounce',
					'route_types' => array(''),
					'webhook_key' => '',
					'listener'    => array(
						'type' => 'queue',
						'name' => ''
					),
					'verify_hook' => false
				)
			)
		)
	)

```

 web\_hooks.enabled Indicates whether to enable or disable the configuration of web hooks web\_hooks.routes An array of route configurations that you wish to define for various event types of mandrillLets look at detail the route configurations.

 routes.route\_url The route URL of the webhook. On the example above it is configured as **/mandrill/send**, the route will be configured to **http://base\_url/mandrill/send** routes.route\_types An array object that contains the list of events that have been configured for this web hook. You would have done this when setting up the web hook on the Mandrill Control Panel. The different event types are listed on . This configuration will only be used if verify\_hook is set to true routes.webhook\_key A key that is automatically generated when a webhook is created. This can be found on the Webhook Control panel of mandrill. Every Webhook has a different key generated. Again, this configuration will only be used if verify\_hook is set to true routes.listener The listener is used to configure a hook on the application to listen to when the webhook is called. There are 2 listeners that you can configure. **Event**, **Queue**. The **type** takes the type of listener that you want to configure it to \[event, queue\]. The **name** takes the name of the listener that should be called. A look at the Laravel docs on how to setup an Event Listener or Queue will help understand.  routes.verify\_hook It takes a boolean value and notifies the route to verify the web hook call. There are 2 verfications that are done here
 a. Mandrill sends an encrypted signature based on the data and the key of the webhook that can be used to verify if the web hook call is actually coming from Mandrill.
 b. It checks if the event type matches the web\_hook call.

 Setting the configuration to **true** will automatically start validating the web hook calls if the calls are from Mandrill or not. No additional coding required\#####Methods  MethodExplanation   Mandrill($credentials) Constructor will initialize the API Key. If no credentials is passed, the credentials will be picked from the config file   ParameterType   $credentials array array('apikey'=&gt;'API\_KEY\_GOES\_HERE')      addRecipient($email,$name) Adds a Recipient for the Email. Multiple Recipients can be added by calling this function again   ParameterType   $email string john@doe.com   $name string John Doe      setHtml($html) Sets the HTML Content for the Email   ParameterType   $html string &lt;strong&gt;Hi \*|user\_name|\*, This is the body of the message. There is also a global merge tag \*|website\_url|\*&lt;/strong&gt;      setText($text) Sets the Text Content for the Email   ParameterType   $text string This is the Text Content of the message      setSubject($subject) Sets the Subject of the Email   ParameterType   $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   ParameterType   $email string sam@supernatural.com   $name string Sam Winchester      setGlobalMergeVariables($key, $value) Set the Global merge variables to use for all recipients. Call this function multiple times to add multiple items.   ParameterType   $key string website\_url   $value string       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.   ParameterTypeExample   $recipient string john@john-doe.com   $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.   ParameterTypeExample   $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.   ParameterTypeExample   $recipient string john@john-doe.com   $key string INVITE   $value string US-MEMBER      setReplyTo($email) Sets the Reply To Email Address   ParameterTypeExample   $email string john@john-doe.com      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   ParameterTypeExample   $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.   ParameterTypeExample   $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   ParameterTypeExample   $value boolean true      shouldTrackOpens($value) Sets whether or not to turn on open tracking for the message. false by default   ParameterTypeExample   $value boolean true      shouldTrackClicks($value) Sets whether or not to turn on click tracking for the message. false by default   ParameterTypeExample   $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   ParameterTypeExample   $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   ParameterTypeExample   $value boolean true      shouldStripUrlQS($value) Sets whether or not to strip the query string from URLs when aggregating tracked URL data. false by default   ParameterTypeExample   $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   ParameterTypeExample   $value boolean true      setBccAddress($value) Sets an optional address to receive an exact copy of each recipient's email   ParameterTypeExample   $value string john@john-doe.com      setTrackingDomain($value) Sets a custom domain to use for tracking opens and clicks instead of mandrillapp.com   ParameterTypeExample   $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)   ParameterTypeExample   $value string john-doe.com      addTags($value) Sets a Tag to the Email. Can be called repeatedly to add multiple tags   ParameterTypeExample   $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.   ParameterTypeExample   $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.   ParameterType   $timestamp DateTime new DateTime('+1 hour');  ```

```

 \###PostMarkApp

\#####Sending Email

```
$postMark = MailTo::PostMark();
$message  = $postMark->getMessageInstance();
$message->addRecipient("RECIPIENT_EMAIL")
	->setFrom("FROM_EMAIL", "FROM_NAME")
	->setSubject("EMAIL_SUBJECT")
	->setHtml("HTML_CONTENT_GOES_HERE")
	->setText("TEXT_CONTENT_GOES_HERE");
$postMark->send($message);

```

\#####Example Response from Postmark for Send Method if Message sent successfully

```
{
  "ErrorCode" : 0,
  "Message" : "OK",
  "MessageID" : "b7bc2f4a-e38e-4336-af7d-e6c392c2f817",
  "SubmittedAt" : "2010-11-26T12:01:05.1794748-05:00",
  "To" : "receiver@example.com"
}

```

\#####Sending Batch Email

```
$postMark = MailTo::PostMark();
$message  = $postMark->getMessageInstance();
$message->addRecipient("RECIPIENT_EMAIL")
    ->setFrom("FROM_EMAIL", "FROM_NAME")
	->setSubject("EMAIL_SUBJECT")
	->setHtml("HTML_CONTENT_GOES_HERE")
	->setText("TEXT_CONTENT_GOES_HERE");
$postMark->send($message);

```

\#####Example Response from Postmark for Send Method if Message sent successfully

```
[
    {
      "ErrorCode" : 0,
      "Message" : "OK",
      "MessageID" : "b7bc2f4a-e38e-4336-af7d-e6c392c2f817",
      "SubmittedAt" : "2010-11-26T12:01:05.1794748-05:00",
      "To" : "receiver1@example.com"
    },
    {
      "ErrorCode" : 0,
      "Message" : "OK",
      "MessageID" : "e2ecbbfc-fe12-463d-b933-9fe22915106d",
      "SubmittedAt" : "2010-11-26T12:01:05.1794748-05:00",
      "To" : "receiver2@example.com"
    }
]

```

\#####Work in progress

- ElasticMail

\#####Implementations coming soon

- MailGun
- PostageApp
- Mad Mimi
- Alpha Mail

[![endorse](https://camo.githubusercontent.com/e2e1f38d1c4438e68411ba9aaa6370eb04eac2279a531b9407123c8db346dd93/68747470733a2f2f6170692e636f64657277616c6c2e636f6d2f6162697368656b727372696b61616e74682f656e646f727365636f756e742e706e67)](https://coderwall.com/abishekrsrikaanth)[![Bitdeli Badge](https://camo.githubusercontent.com/cec3a9d170754d5232b609a716ff462a934c7236ad08d2ed337f67acf0737de3/68747470733a2f2f64327765637a68766c38323376302e636c6f756466726f6e742e6e65742f6162697368656b727372696b61616e74682f6d61696c746f2f7472656e642e706e67)](https://bitdeli.com/free "Bitdeli Badge")

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~78 days

Total

4

Last Release

4402d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/679089de897a6d3f79d14628be0e3a38b3d77ccfa7c1f85ca7de06ae7564b166?d=identicon)[abishekrsrikaanth](/maintainers/abishekrsrikaanth)

---

Top Contributors

[![abishekrsrikaanth](https://avatars.githubusercontent.com/u/1639302?v=4)](https://github.com/abishekrsrikaanth "abishekrsrikaanth (39 commits)")

---

Tags

laravelemailLaravel 4mandrill

### Embed Badge

![Health badge](/badges/abishekrsrikaanth-mailto/health.svg)

```
[![Health](https://phpackages.com/badges/abishekrsrikaanth-mailto/health.svg)](https://phpackages.com/packages/abishekrsrikaanth-mailto)
```

###  Alternatives

[propaganistas/laravel-disposable-email

Disposable email validator

6012.9M7](/packages/propaganistas-laravel-disposable-email)[erag/laravel-disposable-email

A Laravel package to detect and block disposable email addresses.

252143.0k](/packages/erag-laravel-disposable-email)[therobfonz/laravel-mandrill-driver

Mandrill Driver for Laravel

783.7M](/packages/therobfonz-laravel-mandrill-driver)[doxxon/laravel-mandrill-request

Mandrill transactional emails via Laravel 4

2016.6k](/packages/doxxon-laravel-mandrill-request)[osiemsiedem/laravel-autolink

A Laravel package for converting URLs in a given string of text into clickable links.

13135.2k](/packages/osiemsiedem-laravel-autolink)[notebrainslab/filament-email-templates

A powerful and flexible Email Template Management plugin for Filament v4 and v5.

121.1k](/packages/notebrainslab-filament-email-templates)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
