PHP code example of lockally / symfony-mailer

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

    

lockally / symfony-mailer example snippets


use Lockally\Symfony\LockallyTransportFactory;
use Symfony\Component\Mailer\Mailer;
use Symfony\Component\Mailer\Transport\Dsn;

$transport = (new LockallyTransportFactory())
    ->create(Dsn::fromString('lockally+api://YOUR_API_KEY@default'));
$mailer = new Mailer($transport);

use Symfony\Component\Mime\Email;

$email = (new Email())
    ->from('[email protected]')
    ->to('[email protected]')
    ->replyTo('[email protected]')
    ->subject('Your code')
    ->text('code 123')
    ->html('<b>code 123</b>');

$mailer->send($email);