PHP code example of palmtree / wp-mailer

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

    

palmtree / wp-mailer example snippets



use Palmtree\WordPress\Mailer\Mailer;

$mailer = new Mailer('[email protected]', ['[email protected]']);


use Palmtree\WordPress\Mailer\Message;

$message = new Message('[email protected]');

$message
    ->setSubject('Hello!')
    ->setBody('<p>Hey, this is an HTML email!</p>')
    ->addCc('[email protected]')
    ->addBcc('[email protected]');

$message->attach('/path/to/some/file.pdf');

if ($mailer->send($message)) {
    echo 'Sent!';
} else {
    echo 'Error sending';
}