PHP code example of abishekrsrikaanth / mailto

1. Go to this page and download the library: Download abishekrsrikaanth/mailto library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

abishekrsrikaanth / mailto example snippets


$ php composer.phar update

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

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

php artisan config:publish abishekrsrikaanth/mailto

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

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

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

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

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

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

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

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

'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
				)
			)
		)
	)

[
    {
      "ErrorCode" : 0,
      "Message" : "OK",
      "MessageID" : "b7bc2f4a-e38e-4336-af7d-e6c392c2f817",
      "SubmittedAt" : "2010-11-26T12:01:05.1794748-05:00",
      "To" : "[email protected]"
    },
    {
      "ErrorCode" : 0,
      "Message" : "OK",
      "MessageID" : "e2ecbbfc-fe12-463d-b933-9fe22915106d",
      "SubmittedAt" : "2010-11-26T12:01:05.1794748-05:00",
      "To" : "[email protected]"
    }
]