PHP code example of mlpz / postmark-bundle

1. Go to this page and download the library: Download mlpz/postmark-bundle 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/ */

    

mlpz / postmark-bundle example snippets

 bash
$ php composer.phar update mlpz/postmark-bundle
 php

   // app/autoload.php
   $loader->registerNamespaces(array(
    // ...
    'MZ'               => __DIR__.'/../vendor/bundles',
    'Buzz'             => __DIR__.'/../vendor/buzz/lib',
  ));
 php

// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new MZ\PostmarkBundle\MZPostmarkBundle(),
    );
}
 php

$message  = $this->get('postmark.message');
$message->addTo('[email protected]', 'Test Test');
$message->setSubject('subject');
$message->setHTMLMessage('<b>email body</b>');
$message->addAttachment(new Symfony\Component\HttpFoundation\File\File(__FILE__));
$response = $message->send();

$message->addTo('[email protected]', 'Test2 Test');
$message->setSubject('subject2');
$message->setHTMLMessage('<b>email body</b>');
$message->addAttachment(new Symfony\Component\HttpFoundation\File\File(__FILE__), 'usethisfilename.php', 'text/plain');
$response = $message->send();
 php

$message  = $this->get('postmark.message');
$message->addTo('[email protected]', 'Test Test');
$message->setSubject('subject');
$message->setHTMLMessage('<b>email body</b>');
$message->queue(); // Queue the message instead of sending it directly

$message->addTo('[email protected]', 'Test2 Test');
$message->setSubject('subject2');
$message->setHTMLMessage('<b>email body</b>');
$responses = $message->send(); // Send both messages, note that you'll get an array of json responses instead of just the json response