4.3 shipped a Mailer component alongside Swiftmailer rather than replacing it, and the two coexist for the whole of the 4.x line.
use SymfonyComponentMimeEmail;
$email = (new Email())
->from('[email protected]')
->to($customer->email)
->subject('Your order')
->text($plain)
->html($html);
$mailer->send($email);
# transport is a DSN, which is the actual improvement:
# MAILER_DSN=smtp://user:[email protected]:587
The DSN is the part worth migrating for: transport configuration becomes one environment variable rather than a block of YAML, and switching provider is a string change. The message and the transport being separate components is the structural improvement — a MimeEmail can be built and asserted on in a test with no mailer at all. Swiftmailer is deprecated in 5.x, so the migration has a deadline even though nothing is broken today.