Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Mailer] \Symfony\Component\Mailer\Event\MessageEvent never consumed #31449

Closed
@Perf

Description

@Perf

Symfony version(s) affected: 4.3.0-BETA1

Description
When sending email using a newsymfony/mailer component an event\Symfony\Component\Mailer\Event\MessageEvent us dispatched.
Mailer component has two subscribers for this event:
\Symfony\Component\Mailer\EventListener\MessageListener
\Symfony\Component\Mailer\EventListener\EnvelopeListener
but non of them are fired in case of an event.

Commandbin/console de:ev also doesn't shows these listeners.

How to reproduce

  1. create one simple twig template for html part of email, for example:
# templates/email/hello.html.twig<p>Hi {{ email.to }}!</p>
  1. create a console command and inject Mailer in constructor
private$mailer;publicfunction__construct(MailerInterface$mailer)    {$this->mailer =$mailer;parent::__construct();    }
  1. put inexecute method something like:
$email =newTemplatedEmail();$email            ->from('no-reply@domain.com')            ->to('me@domain.com')            ->subject('Test email message')            ->htmlTemplate('email/hello.html.twig')            ;$this->mailer->send($email);
  1. get an Exception

In HandleMessageMiddleware.php line 82:
A message must have a text and/or an HTML part.
In Email.php line 427:
A message must have a text and/or an HTML part.

This exception raised because\Symfony\Component\Mailer\EventListener\MessageListener was not fired.

Possible Solution
¯\_(ツ)_/¯

Additional context
symfony/messenger is installed with default configuration
symfony/swiftmailer-bundle is not installed

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp