PHP code example of nfacha / yii2-yashop-ses

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

    

nfacha / yii2-yashop-ses example snippets


'components' => [
    ...
    'mail' => [
        'class' => 'nfacha\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