PHP code example of rr / api-mailer

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

    

rr / api-mailer example snippets




$mailer = \RR\ApiMailer\ApiMailer::getMailerInstance('sendgrid'); // sendgrid | mailjet
$message = new \RR\ApiMailer\Message(
    'this is subject', // subject
    '[email protected]', // from
    ['[email protected]'], // array of recipients
    'this is text', // plain text email body
    '<h1>this is HTML content</h1>' // HTML email body
);

$result = $mailer->send($message);

if ($result === true) {
    echo 'Successfully sent';
} else { // Error
    var_dump($mailer->getError());
}