bas_vdl
(Bas Vdl)
1
How can i use CEmailLogRoute::sendEmail() inside my view?
in my view
<?php CEmailLogRoute::sendEmail('bas@lustgraaf.nl', 'Foute DT locatie', 'DaytripId: ' . $daytrip->IdDaytrip); ?>
error:
Fatal error: Call to protected method CEmailLogRoute::sendEmail() from context ‘CBaseController’ in **/views/search/_gmaps.php</b> on line 34
zaccaria
(Matteo Falsitta)
2
I think you have to instantiate the mail log route.
<?php
$mailRoute= new CEmailLogRoute;
$mailRoute->sendEmail('bas@lustgraaf.nl', 'Foute DT locatie', 'DaytripId: ' . $daytrip->IdDaytrip); ?>
I didn’t tested, is just the first stuff I am doing when I receive this kind of error.
bas_vdl
(Bas Vdl)
3
CException
Description
CEmailLogRoute does not have a method named "sendEmail".
zaccaria
(Matteo Falsitta)
4
As stated in the doc, this method is protected, you cannot call in the controller.
It seems that you should configure this mailer in the config/main and then logging on it.
Sorry for my first answer, I didn’t read it carefully.
bas_vdl
(Bas Vdl)
6
Edit your config:
'components' => array(
'log' => array(
'class' => 'CLogRouter',
'routes' => array(
array(
'class' => 'CEmailLogRoute',
'levels' => 'error',
'emails' => 'user@domain.com',
),
),
),
),
Yii::log('message' 'error');
see also: http://www.yiiframework.com/doc/guide/1.1/en/topics.logging