I am trying to install the Swiftmailer module on Drupal 8, but I get the following error.

Swift Mailer requires the external Swift Mailer library. The recommended way of solving this dependency is using the Composer Manager module.

The steps I took are the following.

  1. I installed the Libraries and Mail System modules
  2. I installed the Swiftmailer external library, by running composer require swiftmailer/swiftmailer:"~5.4.5" from sites/all/libraries (inside the Drupal root directory)
  3. I uploaded and uncompressed swiftmailer-8.x-1.0-beta2.tar.gz at $DRUPAL_ROOT/modules/. The installation seemed to be successful, afterwards I got a vendor/swiftmailer/swiftmailer directory under sites/all/libraries.
  4. I tried to install the Swiftmailer module with drush en swiftmailer and through the admin UI.

I have also tried the second step from other locations (for example $DRUPAL_ROOT/libraries), with the same result. Note that the Composer Manager module seems to be obsolete and not needed, according to latest information found in Drupal forums/sites.

How do I install the Swiftmailer module?

1 Answer 1


That's 7.x/outdated information unfortunately.

You should use composer to manage your Drupal 8 site, using the drupal-project starting point: https://github.com/drupal-composer/drupal-project. It will be a bit of work to switch an existing site to that but after that, installing swiftmailer including all its dependencies will be as easy as running composer require drupal/swiftmailer. That will automatically include all dependencies.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.