PHP code example of minhyung / ncloud-mailer

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

    

minhyung / ncloud-mailer example snippets


use Minhyung\Ncloud\Mailer\NcloudApiTransport;
use Minhyung\Ncloud\Mailer\NcloudTransportFactory;
use Symfony\Component\Mailer\Transport\Dsn;
use Symfony\Component\Mailer\Mailer;
use Symfony\Component\Mime\Email;

$accessKey = {NCLOUD_ACCESS_KEY};
$secretKey = {NCLOUD_SECRET_KEY};
$options = ['region' => 'KR'];  # option

$dsn = new Dsn('ncloud+api', 'default', $accessKey, $secretKey, options: $options);
$transport = (new NcloudTransportFactory())->create($dsn);

$email = (new Email())
    ->from('[email protected]')
    ->to('[email protected]')
    //->cc('[email protected]')
    //->bcc('[email protected]')
    //->replyTo('[email protected]')
    //->priority(Email::PRIORITY_HIGH)
    ->subject('Time for Symfony Mailer!')
    ->text('Sending emails is fun again!')
    ->html('<p>See Twig integration for better HTML integration!</p>');

$mailer->send($email);