PHP code example of sandstorm / templatemailer

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

    

sandstorm / templatemailer example snippets


$this->emailService->sendTemplateEmail(
    'YourTemplateFileName',
    'An arbitrary email title',
    ['[email protected]']
);

$this->emailService->sendTemplateEmail(
    'YourTemplateFileName',
    'An arbitrary email title',
    ['[email protected]'],
    [
        'var1' => 'Foo',
        'var2' => 5
    ],
    'mysender'
);

$this->emailService->sendTemplateEmail(
    'YourTemplateFileName',
    'An arbitrary email title',
    ['[email protected]'],
    [
        'var1' => 'Foo',
        'var2' => 5
    ],
    ['[email protected]' => 'Your Service Name']
);

$this->emailService->sendTemplateEmail(
    'YourTemplateFileName',
    'An arbitrary email title',
    ['[email protected]'],
    [
        'var1' => 'Foo',
        'var2' => 5
    ],
    'mysender',
    ['[email protected]', '[email protected]'],
    ['[email protected]'],
    [
        [
            'data' => file_get_contents('some/example/file'),
            'filename' => 'YourFileNAme.pdf',
            'contentType' => 'application/pdf'
        ]
    ]
);