Swift Mailer dependency conflict with drupal/core-recommended

Created on 9 December 2021, almost 3 years ago
Updated 12 May 2023, over 1 year ago

Problem/Motivation

I just tried to composer update my platform to Drupal Core 9.3.0, but could not go past 9.3.0-beta3. After some poking around, I figured out that the conflict was that drupal/core-recommended 9.3.0 requires egulias/email-validator 3.1.2 but swiftmailer locks this dependency at ^2.0.

I was able to upgrade to Drupal 9.3.0 after removing drupal/swiftmailer, but now I cannot reinstall swiftmailer due to the same dependency conflict.

Steps to reproduce

  1. Create a Drupal 9.3.x project with drupal/recommended-project
  2. Attempt to composer require drupal/swiftmailer:^2

Proposed resolution

I'd recommend either removing the dependency, since it's already there in core, or changing the dependency to allow egulias/email-validator ^2 || ^3.

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States micahw156

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡§πŸ‡ͺBelgium vodde83

    I still cannot update from Core 9.2 to - in my case - 9.5, but it likely won't go past 9.2 anyway due to Core's ^3 requirement of egulias/email-validator.

    Drupal Swiftmailer 2.4 has this in composer.json:
    "swiftmailer/swiftmailer": "^6.1.3"

    Swiftmailer itself, has this in composer.json (see https://github.com/swiftmailer/swiftmailer/blob/v6.1.3/composer.json):
    "egulias/email-validator": "~2.0"

    So while Drupal Swiftmailer now doesn't care whether you use ^2 or ^3 , Swiftmailer itself will still not go beyond ^2.

    What I believe should fix it, is this is composer.json of Drupal Swiftmailer:
    "swiftmailer/swiftmailer": "^6.3"

    And actually, the entire egulias/email-validator can be removed from composer.json.

    This does however create an issue for people with Core 9.2 or lower. I'm guessing to resolve this in it's entirety, and new major version would be required, only supporting Core 9.3 and upwards?

Production build 0.71.5 2024