PHP code example of edamov / mailtrap-php-sdk

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

    

edamov / mailtrap-php-sdk example snippets



use Mailtrap\Mail;
use Mailtrap\Mailtrap;
use Mailtrap\Recipient;
use Mailtrap\Recipients;
use Mailtrap\Sender;

$mailtrap = Mailtrap::create('api-key');

$sender = new Sender('[email protected]', 'Sender Name');
$recipients = (new Recipients())->add(
    new Recipient('[email protected]', 'Recipient Name')
);

$mail = new Mail($sender, $recipients, 'Subject', 'Email body');

$mailtrap->mailSendingApi->send($mail);