Migrating from Swift Mailer to Drupal Symfony Mailer

Please let me share with you some steps on how to migrate from Swift Mailer to Drupal Symfony Mailer.

1. Install Drupal Symfony Mailer

  1. Install the Drupal Symfony Mailer module.
  2. Add an SMTP transport (postmark) here: /admin/config/system/mailer/transport. If Swift Mailer is still enabled, Drupal Symfony Mailer should have imported that config automatically.
  3. You can remove the sendmail transport that Drupal Symfony Mailer created because we don't need it.
  4. No further configuration is needed for a simple setup. Read this page and this page for more information. The last page explains the 3 levels of compatibility the module provides.

2. Remove Swift Mailer

  1. Swift Mailer depends on Mail System. So before you remove Swift Mailer you should add Mail System explicitly to your composer.json with "composer require".
  2. Uninstall Swift Mailer and Mail System and export config.
  3. Commit & push changes to Git and deploy the changes to the production site.
  4. Remove Mail System via composer.
  5. Commit & push changes to Git.
  6. Deploy to production again.