PHP code example of connectionsbv / yii2-smtp2go

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

    

connectionsbv / yii2-smtp2go example snippets


return [
    //....
    'components' => [
        'mailer' => [
            'class' => 'connectionsbv\smtp2go\Mailer',
            'token' => 'YOUR_TOKEN',
        ],
    ],
];

Yii::$app->mailer->compose()
    ->setFrom('[email protected]')
    ->setTo($to)
    ->setSubject($from)
    ->send();