In order to send mail from application, I use EMailer Extension.
The extension worked great and every thing was great.
But, I started ask me about, where I place the code to setup smtp parameter? Should I repeat the code every time that I have to send mail?
My first thought was write an action to abstract this code, but I have to send mails from others controllers. On the other hand, I wrote a new model, is this correct?
After having done so, you can access the mailer extension via [font="Courier New"]Yii::app()->mailer->…[/font]
In general, Yii favours fat model opposed to fat controller (i.e. store all the business logic in your models). If you need to share logic between different models, try to write a behavior.
I made changes in my code to setup EMailer extension into main.php file. Everything works well.
On the other hand, I read the information about Behaviors and Models.
When I have to create a business logic model and this model is not related with a table directly, Do I have to create a model inherits from CFormModel?