2024-10-18 351次浏览

Major versions of Yii Mailer and Yii Mailer Symfony Mailer packages were tagged.

The Yii Mailer abstraction for sending emails has been significantly reworked.

Now, the package yiisoft/mailer is independent of any other dependencies and essentially consists of two interfaces: MessageInterface (a message with methods for setting/getting values) and MailerInterface (a service for sending messages with two methods: send() and sendMultiple() ).

Yii Mailer changes:

  • Add NullMailer and StubMailer .
  • Add FileMailer configuration.
  • Add HtmlToTextBodyConverter .
  • Add MessageInterface methods: getAttachments() , getEmbeddings() , getHeaders() , withAddedAttachments() , withAddedEmbeddings() .
  • Add Message class that implements MessageInterface .
  • Remove MessageFactoryInterface and MessageFactory , add MessageSettings instead it.
  • Remove MessageBodyRenderer and MessageBodyTemplate classes.
  • Remove yiisoft/view dependency.
  • Remove MessageInterface methods compose() , withTemplate() and withLocale() .
  • Rename Mailer to BaseMailer , remove beforeSend() and afterSend() methods, finalize methods, and mark dependencies as read only.
  • Remove getMessage() method from AfterSend and BeforeSend classes, make $message property public read only instead it.
  • Change result type of MessageInterface::with* methods from self to static .
  • Remove implementation of StoppableEventInterface from BeforeSend and add $preventSendingMessage property to it.
  • Remove beforeSend() and afterSend() messages from BaseMailer .
  • Rename MessageInterface methods: withEmbedded() to withEmbeddings() , withAttached() to withAttachments() and allow passing several files to them.
  • Remove getError() and withError() methods from MessageInterface.
  • Change result of MailerInterface::sendMultiple() to SendResults object.
  • Use new Priority enumeration instead of integer value for define priority in message.
  • Change order of constructor parameters in Mailer and FailMailer .
  • Make psr/event-dispatcher dependency optional.
  • Replace RuntimeException to LogicException when file name callback of FileMailer returns non-string value and improve - exception message.

Yii Mailer Symfony Mailer Extension changes:

  • Change package configuration params prefix to yiisoft/mailer-symfony .
  • Adapt to Yii Mailer 6: remove Message class, add $messageSettings parameter to Mailer constructor, remove MessageBodyRenderer usage.
  • Raise minimal PHP version to ^8.1 .
  • Change order of constructor parameters in Mailer .
  • Remove FileMailer configuration and writeToFiles parameter from package configuration.
  • Make psr/event-dispatcher dependency optional.
  • Use file ID for attachments and embedded files.