Error > mail

I want error mails when I the site generate error, but with this configuration I doesnt get any mails …


        // Log configuration

        'log' => array(

            'class' => 'CLogRouter',

            'routes' => array(

                array(

                    'class' => 'CFileLogRoute',

                    'levels' => 'error, warning',

                ),

	            array(

	                'class'		=> 'CEmailLogRoute',

	                'levels'	=> 'error, warning, info',

	                'emails'	=> => 'mail@mail.com',

	                'sentFrom'	=> 'mail@mail.com',

                    'subject'	=> 'Error at mysite.com site',

	            ),

            ),

        ),

You should configure ‘emails’ => ‘mail@mail.com’, to be a valid mail, also you have a strange syintax here.

Try also to run the command mail() in php, if it doesn’t work in means that you have to configure a valid smtp

Where you see a strange syntax?

And where can I set my SMTP server?


'emails'        => => 'mail@mail.com',



should be


'emails'        => 'mail@mail.com',



Yes, I misspelled it, when I typed the example :slight_smile: (not in my code)

Still doesnt work …

How can you expect someone to help you if you write only “still doesn’t work”…

have you tried the standard PHP function mail()… does it send mails?

If it does, then it’s something with the config in Yii…

if it doesn’t then it’s something with the settings on your system…

I’m Sorry, here some better information:

I changed the mail() function in my own mail extension. But I still doesn’t receive any mails when I enter a wrong url.

When I create a test function with my own mail extension, I receive mails.

So my question, when will the sendMail function in CEmailLogRoute.php activated?

It’s called from CEmailLogRoute->processLogs()… sendEmails() calls the PHP mail() function… so I don’t understand what you mean with your “own mail extension”

Edit your PHP.INI file. Go to the [mail function] section and modify it

I create an own extension for mailing, and that function I call in sendEmails()

OK, but to be clear what is wrong here… have you tried withouth your extension… just the Yii implementation… does it send mails?

Found the error !


    

    // Preloading 'log' component

    'preload' => array('log'),



Did not add this to my config/mail.php

Nice catch… glad you found it :)