PHP code example of lettermint / lettermint-php

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

    

lettermint / lettermint-php example snippets


$lettermint = new Lettermint\Lettermint('your-api-token');

$response = $lettermint->email
                       ->from('[email protected]')
                       ->to('[email protected]')
                       ->subject('Hello from Lettermint!')
                       ->text('Hello! This is a test email.')
                       ->send();


$lettermint->email
    ->from('John Doe <[email protected]>')
    ->to('[email protected]', '[email protected]')
    ->cc('[email protected]')
    ->bcc('[email protected]')
    ->replyTo('[email protected]')
    ->subject('Hello world!')
    ->html('<h1>Hello!</h1>')
    ->text('Hello!')
    ->headers(['X-Custom-Header' => 'Value'])
    ->attach('document.pdf', base64_encode($fileContent))
    ->send();
bash
composer