Skip to content

Component for Yii which provides simple configuration interface for Swift Mailer

License

Notifications You must be signed in to change notification settings

sobit/swiftmailer-component

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

swiftmailer-component

Component for Yii Framework based application which provides simple configuration interface for Swift Mailer library.

Installation

Add dependency to your composer.json file:

{
    "require": {
        "sobit/swiftmailer-component": "dev-master"
    }
}

Update your protected/config/main.php file:

<?php

Yii::setPathOfAlias('vendor', dirname(__FILE__) . '/../../vendor');

return array(
    'components' => array(
        'mailer' => array(
            'class' => 'vendor.sobit.swiftmailer-component.SwiftMailerComponent',

            'swiftBasePath' => dirname(__FILE__) . '/../../vendor/swiftmailer/swiftmailer',

            'host'     => 'localhost', // smtp host
            'port'     => 25,          // smtp port
            'username' => null,        // username
            'password' => null,        // password
            'security' => null,        // security, e.g. "ssl"
        ),
    ),
);

Usage

Most simple usage example:

$message = Yii::app()->mailer
    ->createMessage('Test subject', 'Test body content')
    ->setFrom(array('[email protected]' => 'John Doe'))
    ->setTo(array('[email protected]', '[email protected]' => 'A name'))
;
Yii::app()->mailer->send($message);

About

Component for Yii which provides simple configuration interface for Swift Mailer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages