2017 © Pedro Peláez
 

yii2-extension yii2-yashop-ses

Extension for sending emails via amazon ses

image

ofat/yii2-yashop-ses

Extension for sending emails via amazon ses

  • Wednesday, December 7, 2016
  • by ofat
  • Repository
  • 5 Watchers
  • 5 Stars
  • 25,010 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 13 Forks
  • 4 Open issues
  • 5 Versions
  • 10 % Grown

The README.md

Amazon ses extension for Yii2

Extension for sending emails via amazon ses. Part of YaShop, (*1)

Installation

The preferred way to install this extension is through composer., (*2)

Either run, (*3)

php composer.phar require --prefer-dist ofat/yii2-yashop-ses "*"

or add, (*4)

"ofat/yii2-yashop-ses": "*"

to the require section of your composer.json file., (*5)

Usage

To use this extension, you should configure it in the application configuration like the following:, (*6)

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

To send an email, you may use the following code:, (*7)

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

To send an email with headers, you may use the following code:, (*8)

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

Increase the speed of sending emails:, (*9)

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('from@domain.com')
        ->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);

The Versions

07/12 2016

dev-master

9999999-dev

Extension for sending emails via amazon ses

  Sources   Download

MIT

The Requires

 

by Vitaliy Ofat

extension yii2 aws ses

07/12 2016

v1.0.3

1.0.3.0

Extension for sending emails via amazon ses

  Sources   Download

MIT

The Requires

 

by Vitaliy Ofat

extension yii2 aws ses

06/12 2016

v1.0.2

1.0.2.0

Extension for sending emails via amazon ses

  Sources   Download

MIT

The Requires

 

by Vitaliy Ofat

extension yii2 aws ses

08/03 2015

v1.0.1

1.0.1.0

Extension for sending emails via amazon ses

  Sources   Download

MIT

The Requires

 

by Vitaliy Ofat

extension yii2 aws ses

02/05 2014

v1.0.0

1.0.0.0

Extension for sending emails via amazon ses

  Sources   Download

MIT

The Requires

 

by Vitaliy Ofat

extension yii2 aws ses