Setup ¶
Please note that SES by Amazon must be setup on the server. Please see their setup instructions on how to do so.
- Put the SES directory in the extensions.
- Install phpmailer (I'd recommend composer)
- Go to the main.php (or wherever you want this component to be) and add the configuration:
imports(array(
'application.extensions.SES.*',
)),
components(
array(
'ses'=>array(
'class' => 'SESComponent',
'host' => "tls://email-smtp.us-east-1.amazonaws.com", //Amazon Server
'username' => "xxxxxxxxxxxxxxxxxx", //Enter Username from Amazon
'password' => "xxxxxxxxxxxxxxxxxxxx", //Enter Pasword from Amazon
'port' => 465, //Port number from Amazon
'SMTPAuth' => true,
'from' => "xxx@xxxxxx.xxx", //May be from any email you want
'fromName' => "xxxxxxxxxxxx",
'charSet' => "UTF-8",
'sender' => 'xxxxxx@xxxxxxx.xxx', //Sender has to be verified email !!!
'errorEmailAddresses' => array(
'xxx@xxxxx.comxx'=> "name1",
'2@xxxx.com' => 'name2',
),
),
),
Usage ¶
Yii::app()->ses->sendEmail("test@whatever.com","My first email","Hello World!");
Yii::app()->ses->sendEmails(
array(
"Name1" => "name@test.com",
"name2" => "name2@mycoolsite.com"
), "This is only a subject", "Body!");
Requirements ¶
Yii 1.1 or above PHPMailer
Resources ¶
- Download at Yii SES
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.