Yii Framework Forum: [SOLVED] Use CEmailLogRoute::sendEmail() in view - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

[SOLVED] Use CEmailLogRoute::sendEmail() in view Call to protected method CEmailLogRoute::sendEmail() Rate Topic: -----

#1 User is offline   bas_vdl 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 215
  • Joined: 01-April 09

Posted 01 November 2010 - 07:22 AM

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
0

#2 User is offline   zaccaria 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 2,232
  • Joined: 04-October 09
  • Location:Moscow

Posted 01 November 2010 - 07:33 AM

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.
0

#3 User is offline   bas_vdl 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 215
  • Joined: 01-April 09

Posted 01 November 2010 - 07:40 AM

View Postzaccaria, on 01 November 2010 - 07:33 AM, said:

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.


CException
Description

CEmailLogRoute does not have a method named "sendEmail".
0

#4 User is offline   zaccaria 

  • Elite Member
  • PipPipPipPipPip
  • Yii
  • Group: Members
  • Posts: 2,232
  • Joined: 04-October 09
  • Location:Moscow

Posted 01 November 2010 - 08:25 AM

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.
0

#5 User is offline   bas_vdl 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 215
  • Joined: 01-April 09

Posted 01 November 2010 - 08:47 AM

View Postzaccaria, on 01 November 2010 - 08:25 AM, said:

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.


ah i see. thank you!
0

#6 User is offline   bas_vdl 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 215
  • Joined: 01-April 09

Posted 01 November 2010 - 09:32 AM

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.yiiframew.../topics.logging
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users