PHP code example of emercurymail / smtp-sdk

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

    

emercurymail / smtp-sdk example snippets




use Emercury\SmtpSdk\Api\EmailApi;
use Emercury\SmtpSdk\Configuration;
use Emercury\SmtpSdk\Model\EmailAddress;
use Emercury\SmtpSdk\Model\EmailContentPart;
use Emercury\SmtpSdk\Model\SendEmailRequest;
use GuzzleHttp\Client;

> 'Example']),
    'to' => new EmailAddress(['email' => '[email protected]']),
    'subject' => 'Hello from Emercury',
    'contents' => [new EmailContentPart([
        'content_type' => 'text/plain',
        'content' => 'Your transactional email is ready.',
    ])],
]);

$result = (new EmailApi(new Client(), $configuration))->sendEmail(
    $email,
    idempotency_key: '01992ee0-31a6-783c-bd0d-2677ef418ee8',
);