Use XOAuth2 with PHPMailer?

(5 posts) (2 voices)

Tags:

No tags yet.

  1. duane, Member

    Hi. Another issue that has arrisen due to gmail I think: my smtp sending via email (Google Workspace) has started failing (Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/TroubleshootingSMTP server error: Called RSET without being connected)

    From my investigation so far, it looks like Google is no longer allowing SMTP sending via the "Less secure app" option. See https://stackoverflow.com/questions/72113637/how-to-use-phpmailer-after-30-may-2022-when-less-secure-app-is-no-longer-an-o

    PHPMailer seems to allow using XOAUTH2 to authenticate instead, but this would need to be enabled via the mydbr settings (otherwise I'd need to edit the PHPMailer code directly). Is this something you can/plan to add?

    Cheers,

  2. myDBR Team, Key Master

    You are using Google's app password in mail settings?

    We can take a look at adding XOAUTH2.

    --
    myDBR Team

  3. duane, Member

    > You are using Google's app password in mail settings?

    Yes - I was using the SMTP of Google Workspaces (legacy account) which has stopped working as of last Thursday/Friday. Gmail-only users lost this in May 2022 but it seems they are now applying it to other gmail accounts.

  4. myDBR Team, Key Master

    Google XOAUTH2 authentication has been added into myDBR 6.6.2.

    --
    myDBR Team

  5. duane, Member

    Hi! I finally tried this out (after taking a while to figure out the Google API/OAuth settings and it seems to work great!

    Not only did I add the client id, secret and then generate and copy-and-paste the token from the results screen, but I set the SMTP server to smtp.gmail.com and other settings to TLS and port 587, but the dbr.mail.debug level at 4 seemed to show a successful negotiation.

    I'll continue to use it and see how it goes, but so far so good.

    Thanks for this, I had resorted to using a local smtp and that meant all the dmarc and other anti-spam headers were no longer included, so email was often going to spam.


Reply

You must log in to post.