-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improved initYiiStrap and update README.md
- Loading branch information
1 parent
f3697a6
commit e708bf5
Showing
2 changed files
with
44 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,26 +80,14 @@ Download the [latest version](https://github.com/cornernote/yii-email-module/arc | |
|
||
## Configuration | ||
|
||
If you installed with composer, you should set an alias to your `vendor` folder in your yii configuration: | ||
|
||
```php | ||
return array( | ||
'aliases' => array( | ||
'vendor' => '/path/to/vendor', | ||
), | ||
); | ||
``` | ||
|
||
Add yii-email-module to the `modules` in your yii configuration: | ||
|
||
```php | ||
return array( | ||
'modules' => array( | ||
'email' => array( | ||
// path to the EmailModule class | ||
'class' => 'vendor.cornernote.yii-email-module.email.EmailModule', | ||
// if you downloaded into modules | ||
//'class' => 'application.modules.email.EmailModule', | ||
'class' => '/path/to/vendor/cornernote/yii-email-module/email/EmailModule', | ||
|
||
// add a list of users who can access the email module | ||
'adminUsers' => array('admin'), | ||
|
@@ -199,11 +187,13 @@ return array( | |
Yii::app()->emailManager->email('[email protected]', 'test email', '<b>Hello</b> <i>World<i>!'); | ||
``` | ||
|
||
|
||
### Using Templates | ||
|
||
To send more complex emails you will need to use Email Templates. | ||
|
||
### Component | ||
|
||
#### Component | ||
|
||
Create a new component in `components/Email.php`: | ||
|
||
|
@@ -238,7 +228,8 @@ class Email { | |
} | ||
``` | ||
|
||
### PHP Templates | ||
|
||
#### PHP Templates | ||
|
||
Subject `views/emails/example/subject.php`: | ||
```php | ||
|
@@ -255,7 +246,8 @@ Message `views/emails/example/message.php`: | |
<?php echo 'Here is an <b>awesome</b> email!'; | ||
``` | ||
|
||
### DB Templates | ||
|
||
#### DB Templates | ||
|
||
Subject | ||
``` | ||
|
@@ -273,7 +265,7 @@ Here is an <b>awesome</b> email! | |
``` | ||
|
||
|
||
### Sending the Email | ||
#### Sending the Email | ||
|
||
Now you can send an email like this: | ||
|
||
|
@@ -282,6 +274,7 @@ $user = User::model()->findByPk(123); | |
Email::sendUserWelcome($user); | ||
``` | ||
|
||
|
||
### Sending Spooled Emails | ||
|
||
You can send the spooled emails using the yiic command: | ||
|
@@ -290,6 +283,7 @@ You can send the spooled emails using the yiic command: | |
yiic emailSpool | ||
``` | ||
|
||
|
||
### Automatically Sending | ||
|
||
Setup [lockrun](https://github.com/pushcx/lockrun) for overlap protection. This allows us to setup a cron job that will run every minute, with no risk of a new process starting if an existing process is running. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters