Hi
I was trying to run GitHub - yiisoft/mailer-symfony: Yii Framework Symfony Mailer Integration extenstion with my Yii 2.0 but I’m doing something wrong :(.
It seems that either I’m so PHP novice or I can’t read properly Yii documentation.
In mailer-sympfony documentation there is instruction to create Mailer instance like this:
$template = new MessageBodyTemplate('/path/to/directory/of/view-files');
$mailer = new Mailer(
new MessageFactory(Message::class),
new MessageBodyRenderer($view, $template),
$dispatcher,
$transport,
);
At first glance I though that this will be easy - but then realised that I don’t know how I can get $view, $dispatcher and $transport instances… I found that $view I can get by:
Yii::$app->view;
But what can I do to get remaining others?
Then I picked different approach. I thought that maybe I should get it via $config - so I tried:
'mailer' => [
'class' => 'Symfony\Component\Mailer\Mailer',
],
Now when I’m trying to send e-mail I’m getting exception:
Can not instantiate Symfony\Component\Mailer\Transport\TransportInterface.
I’ve got a feeling that I’m doing it completely wrong :(. Maybe some of you can point me to some direction - thanks!