symfonysymfony-mailer

Symfony Mailer - Migrate addPart from SwiftMailer


I am migrating from SwiftMailer to Symfony Mailer in my application.

How to migrate addPart method of SwiftMailer to Symfony Mailer? In my case the content type is text/plain

->addPart('Plain text content', 'text/plain');

using


Solution

  • To set the plain text part of your email with Symfony Mailer, you can use

    $email->text("...")
    

    See https://symfony.com/doc/current/mailer.html#message-contents for a complete reference