PHP code example of tuxone / postmark-bundle

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

    

tuxone / postmark-bundle example snippets


/**
     * Add fake attachment
     *
     * @param string $file
     * @param string $filename  null
     * @param string $mimeType  null
     * @return Message
     */
    public function addFakeAttachment($file, $filename, $mimeType)
    {

        $this->attachments[] = array(
            'Name'        => $filename,
            'Content'     => base64_encode($file),
            'ContentType' => $mimeType
        );

        return $this;
    }
 php

$message  = $this->get('postmark.message');
$message->addTo('[email protected]', 'Test Test');
$message->setSubject('subject');
$message->setHTMLMessage('<b>email body</b>');
$message->addFakeAttachment('Hello world', 'filename.txt', 'text/plain');
$response = $message->send();