PHP code example of ofat / yii2-yashop-ses

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

    

ofat / yii2-yashop-ses example snippets


'components' => [
    ...
    'mail' => [
        'class' => 'yashop\ses\Mailer',
        'access_key' => 'Your access key',
        'secret_key' => 'Your secret key',
        'host' => 'email.us-east-1.amazonaws.com' // not 

Yii::$app->mail->compose('contact/html', ['contactForm' => $form])
    ->setFrom('[email protected]')
    ->setTo($form->email)
    ->setSubject($form->subject)
    ->send();

Yii::$app->mail->compose('contact/html', ['contactForm' => $form])
    ->setFrom('[email protected]')
    ->setTo($form->email)
    ->setSubject($form->subject)
    ->setHeader('Precedence', 'bulk')
    ->setHeader('List-id', '<1>')
    ->setHeader('List-Unsubscribe', Url::to(['user/unsubscribe'], true))
    ->send();

Yii::$app->mailer->getSES()->enableVerifyHost(false);
Yii::$app->mailer->getSES()->enableVerifyPeer(false);
Yii::$app->mailer->getSES()->enableKeepAlive();

foreach ($emails as $email) {
    Yii::$app->mail->compose('delivery/mail', [])
        ->setFrom('[email protected]')
        ->setTo($email)
        ->setSubject($subject)
        ->setHeader('Precedence', 'bulk')
        ->setHeader('List-id', '<1>')
        ->setHeader('List-Unsubscribe', Url::to(['user/unsubscribe'], true))
        ->send();
}

Yii::$app->mailer->getSES()->enableKeepAlive(false);

php composer.phar