PHP code example of emercury-dev / smtp-php-mailer

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

    

emercury-dev / smtp-php-mailer example snippets


use Emercury\Smtp\SmtpApiTransport;
use Symfony\Component\Mailer\Mailer;
use Symfony\Component\Mime\Email;
use Symfony\Component\Mime\Address;

$mailer = new Mailer(new SmtpApiTransport('xxxTokenxxx'));

$email = (new Email())
    ->from(new Address('[email protected]', 'Hello'))
    ->to(new Address('[email protected]', 'You'))
    ->replyTo(new Address('[email protected]', 'Hello'))
    ->subject('Hello!')
    ->text('Sending emails is fun!')
    ->html('<p>Sending emails is fun with HTML integration!</p>');

$mailer->send($email);