PHP code example of supersendtx / symfony-mailer

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

    

supersendtx / symfony-mailer example snippets


use SuperSendTX\Client;
use SuperSendTX\Symfony\Transport\SuperSendTXTransport;
use Symfony\Component\Mailer\Mailer;
use Symfony\Component\Mime\Email;

$mailer = new Mailer(new SuperSendTXTransport(new Client(getenv('SUPERSENDTX_API_KEY'))));

$email = (new Email())
    ->from('[email protected]')
    ->to('[email protected]')
    ->subject('Welcome')
    ->html('<p>Welcome.</p>');

$mailer->send($email);

use SuperSendTX\Symfony\Transport\SuperSendTXTransportFactory;
use Symfony\Component\Mailer\Transport;

$transport = Transport::fromDsns(
    'supersendtx+api://%s@default',
    null,
    null,
    null,
    [new SuperSendTXTransportFactory()],
);
// Or: supersendtx://default?api_key=stx_…
bash
export SUPERSENDTX_API_KEY=stx_your_key_here