Symfony/mailer v6.4.3 + gmail SMTP issues

Created on 5 February 2024, over 1 year ago

This appears to be an issue with symfony/mailer and not this module per se, but I wanted to post this here in case it can help anyone else.

I updated Drupal Commerce from 2.3.6 to 2.3.7, and in the background, that triggered an update of symfony/mailer from v6.4.0 to v6.4.3.

Once I pushed out that update, I could no longer send any email via SMTP to Google/Gmail. I tried for hours to find the issue, changing my app password and verifying all my settings, DKIM, etc.

I was able to verify via a separate environment that I could still authenticate and send emails with exactly the same credentials as long as symfony/mailer hadn't been updated to v6.4.3

Here's an example of the error message I would receive anytime an email send was attempted:

Error sending email: Failed to authenticate on SMTP server with username "myemail@mydomain.com" using the following authenticators: "LOGIN", "PLAIN", "XOAUTH2". Authenticator "LOGIN" returned "Expected response code "235" but got code "535", with message "535-5.7.8 Username and Password not accepted. For more information, go to 535 5.7.8 https://support.google.com/mail/?p=BadCredentials g17-20020a05620a40d100b007831f8c5aeasm119457qko.55 - gsmtp".". Authenticator "PLAIN" returned "Expected response code "235" but got code "535", with message "535-5.7.8 Username and Password not accepted. For more information, go to 535 5.7.8 https://support.google.com/mail/?p=BadCredentials g17-20020a05620a40d100b007831f8c5aeasm119457qko.55 - gsmtp".". Authenticator "XOAUTH2" returned "Expected response code "235" but got code "334", with message "334 eyJzdGF0dXMiOiI0MDAiLCJzY2hlbWVzIjoiQmVhcmVyIiwic2NvcGUiOiJodHRwczovL21haWwuZ29vZ2xlLmNvbS8ifQ==".".

So in the end, when I rolled back symfony/mailer to v6.4.0 I was able to authenticate via SMTP and send emails again.

composer require 'symfony/mailer:6.4.0'

Again, just wanted to share my findings in case anyone else is having the same issue.

πŸ› Bug report
Status

Needs work

Version

1.4

Component

Miscellaneous

Created by

πŸ‡ΊπŸ‡ΈUnited States bradhawkins

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

Comments & Activities

  • Issue created by @bradhawkins
  • Status changed to Active over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States bradhawkins
  • πŸ‡¬πŸ‡§United Kingdom griz

    I found that if you copy the password to the clipboard, it contains spaces between each block of four characters. Removing the spaces worked for me.

  • πŸ‡¬πŸ‡§United Kingdom jpontet

    I have the same error on v1.4.1 as well. I will also try downgrading to v1.4.0 to try to resolve it.
    Has anyone been able to isolate the issue? Perhaps a patch?

  • Thank you @griz ! You save my day)

  • I have created this account just to thanks @griz. You saved my day. My problem was not Drupal but Mautic's symfony mailer DSN.
    I did everything in my power. Wasted the whole day and then finally with enough google search I found your comment and removed the spaces between the app password for Gmail and then it worked like a charm.
    I previously used App Password with space in different applications and they worked, so never thought of this. However thank you again and again.
    And for SEO: Mautic Gmail Google Mailer SMTP error can be fixed if you use App Password and remove spaces between those App Password.
    You are welcome!

  • πŸ‡ͺπŸ‡ΈSpain tolivera

    Thank you @griz

    Indeed, when copying and pasting, the blank spaces are included. Removing them solved the problem.

    I guess many people will have the same problem :(

  • πŸ‡ΊπŸ‡ΈUnited States crutch

    We started having this issue recently. I've reset the password for the gmail account and at /admin/config/system/mailer/transport with still the same error as #1. Using symfony/mailer v6.4.18 and drupal core 10.3.13

    Unable to downgrade to symfony/mailer v6.4.0 because of core version. Was able to go down to 6.4.7 but it didn't fix the issue.

    Where are you seeing spaces in the password?

Production build 0.71.5 2024