php - Yii 2: Unable to send log via mail -


this mailer component. can see, because of test purposes, i'm using email on file

'mailer' => [         'class'             => 'yii\swiftmailer\mailer',         'viewpath'          => '@common/mail',         'usefiletransport'  => true,     ], 

this log component.

'log'       => [         'tracelevel' => yii_debug ? 3 : 0,         'targets'   => [             [                 // target, see http://www.yiiframework.com/doc-2.0/guide-runtime-logging.html                 'class'         => 'yii\log\emailtarget',                 'levels'        => ['error'],                 'categories'    => ['yii\db\*', 'email_test'],                 'message'       => [                    'from'           => eshop_email,                    'to'             => developer_email,                    'subject'        => 'errore db [' . yii_env . ']',                 ],             ],         ],     ], 

in sitecontrolle->actionindex() i'm testing log , email component in way

public function actionindex() {     yii::error("testing mail log", "email_test");      yii::$app->mailer->compose()         ->setfrom([eshop_email => eshop])         ->setto( developer_email)         ->setsubject("actionindex executed on time " . date ("h:i:s"))         ->settextbody("useless body")         ->send();      return $this->render('index'); } 

as expect, @ every reload of index page got 2 .eml files created inside frontend/runtime/mail folder.

so swiftmailer working, , log system.

now problem

i try remove use of file mailer component, commenting row

        'usefiletransport'  => true, 

when reload index page, got second mail, 1 manually composed , sent, not receive first mail, 1 should automatically composed , sent log system using swiftmailer.

what's wrong?

sorry everyone.

the problem mistake in destination address. using logger error caused email cannot sent, using manual sending destination address error ignored , email sent.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -