PHP code example of purocean / yii2-sendcloud-mailer

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

    

purocean / yii2-sendcloud-mailer example snippets


// append to yii application config file.
    'components' => [
        // ...
        'mailer' => [
            'class'            => 'SendcloudMailer\Mailer',
            'viewPath'         => '@app/mail',
            'useFileTransport' => false,

            // sendcloud params
            'apiUser'          => 'xxxxx',
            'apiKey'           => 'xxxxx',
            'from'             => '[email protected]',
            'fromName'         => 'xxxxx',
        ],
        // ...
    ]

// some php file
Yii::$app
    ->mailer
    ->compose(
        ['html' => 'template_html'],
        ['var' => 'HELLOWORLD!']
    )
    ->setTo('[email protected]')
    ->setCc('[email protected]')
    ->setSubject('subject')
    ->send();
bash
cd test
vim test.php # config params
php test.php