Forum Replies Created

Viewing 15 replies - 1 through 15 (of 16 total)
  • Thread Starter V Chappell

    (@vcchappell)

    Never mind! Figured it out. It was a cPanel issue.

    In WHM it is necessary to go to Tweak Settings, then under the Mail tab, set “Restrict outgoing SMTP to root, exim, and mailman (FKA SMTP Tweak)” to Off.

    Thread Starter V Chappell

    (@vcchappell)

    Cheers!

    Thread Starter V Chappell

    (@vcchappell)

    I was able to get it to work for multiple sites within the same project by adding this line of code:

    $google_client->setApprovalPrompt ( 'force' );

    To line 44 of class.phpmaileroauthgoogle.php

    This was from the stackoverflow link I sent earlier. It forces the Google “approval” prompt when granting permission for each site, even if approval was previously given for a different site in the same project. That way the refresh token is always retreived.

    I’ve patched the plugin on my end, but if you could incorporate this in a future release (if it looks ok to you, of course) that might help others avoid this problem in the future.

    Thanks for all of your help and your quick responses!

    Thread Starter V Chappell

    (@vcchappell)

    Thank you so much, I appreciate it!

    Thread Starter V Chappell

    (@vcchappell)

    Yes. Each one with the corresponding domain for that site.

    Maybe it has something to do with the fact that when I clicked “Grant Permission” for the first site, it went to Google and made me “approve” access, but each time I clicked it for the other sites it didn’t make me approve anymore.

    https://stackoverflow.com/questions/39314833/google-api-client-refresh-token-must-be-passed-in-or-set-as-part-of-setaccessto
    (first answer says “We must force the approvalPrompt.”)

    But I dunno. I’m a developer but not super familiar with the Gmail API.

    Thread Starter V Chappell

    (@vcchappell)

    No, I have 5 different OAuth 2.0 Client IDs set up under my project and each one is using a different Client ID and Client Secret. All have a green check that says “Enabled.” They are all under the same project and use the same e-mail address (of a Google Workspace account). All 5 domains are listed as Authorized Domains under the Branding section of the Google Console.

    Thread Starter V Chappell

    (@vcchappell)

    Yes, it is working on one site only.

    Here is the PHP Log for the last attempted send from one of the sites it is not working from:

    [15-Jul-2025 00:55:16 UTC] PHP Fatal error: Uncaught LogicException: refresh token must be passed in or set as part of setAccessToken in /var/www/mysite/wp-content/plugins/gmail-smtp/google-api-php-client/src/Google/Client.php:267
    Stack trace:
    #0 /var/www/mysite/wp-content/plugins/gmail-smtp/google-api-php-client/src/Google/Client.php(255): Google_Client->fetchAccessTokenWithRefreshToken()
    #1 /var/www/mysite/wp-content/plugins/gmail-smtp/class.phpmaileroauthgoogle.php(150): Google_Client->refreshToken()
    #2 /var/www/mysite/wp-includes/PHPMailer/SMTP.php(626): GmailXOAuth2->getOauth64()
    #3 /var/www/mysite/wp-content/plugins/gmail-smtp/class.phpmaileroauth.php(158): PHPMailer\PHPMailer\SMTP->authenticate()
    #4 /var/www/mysite/wp-includes/PHPMailer/PHPMailer.php(2060): PHPMailerOAuth->smtpConnect()
    #5 /var/www/mysite/wp-includes/PHPMailer/PHPMailer.php(1689): PHPMailer\PHPMailer\PHPMailer->smtpSend()
    #6 /var/www/mysite/wp-includes/PHPMailer/PHPMailer.php(1523): PHPMailer\PHPMailer\PHPMailer->postSend()
    #7 /var/www/mysite/wp-content/plugins in /var/www/mysite/wp-content/plugins/gmail-smtp/google-api-php-client/src/Google/Client.php on line 267

    Thread Starter V Chappell

    (@vcchappell)

    Ok, it looks like it took several hours for the permission to be granted. I am no longer getting the authentication error.

    But I still can’t send e-mails. When I try to send a test e-mail I get the following:

    2025-07-15 00:55:15 Connection: opening to smtp.gmail.com:587, timeout=300, options=array()
    2025-07-15 00:55:15 Connection: opened
    2025-07-15 00:55:16 SMTP INBOUND: "220 smtp.gmail.com ESMTP 006d021491bc7-613d9d837f1sm1260332eaf.11 - gsmtp"
    2025-07-15 00:55:16 SERVER -> CLIENT: 220 smtp.gmail.com ESMTP 006d021491bc7-613d9d837f1sm1260332eaf.11 - gsmtp
    2025-07-15 00:55:16 CLIENT -> SERVER: EHLO www.mysite.com
    2025-07-15 00:55:16 SMTP INBOUND: "250-smtp.gmail.com at your service, [169.44.xxx.xxx]"
    2025-07-15 00:55:16 SMTP INBOUND: "250-SIZE 36700160"
    2025-07-15 00:55:16 SMTP INBOUND: "250-8BITMIME"
    2025-07-15 00:55:16 SMTP INBOUND: "250-STARTTLS"
    2025-07-15 00:55:16 SMTP INBOUND: "250-ENHANCEDSTATUSCODES"
    2025-07-15 00:55:16 SMTP INBOUND: "250-PIPELINING"
    2025-07-15 00:55:16 SMTP INBOUND: "250-CHUNKING"
    2025-07-15 00:55:16 SMTP INBOUND: "250 SMTPUTF8"
    2025-07-15 00:55:16 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [169.44.xxx.xxx]250-SIZE 36700160250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
    2025-07-15 00:55:16 CLIENT -> SERVER: STARTTLS
    2025-07-15 00:55:16 SMTP INBOUND: "220 2.0.0 Ready to start TLS"
    2025-07-15 00:55:16 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
    2025-07-15 00:55:16 CLIENT -> SERVER: EHLO www.mysite.com
    2025-07-15 00:55:16 SMTP INBOUND: "250-smtp.gmail.com at your service, [169.44.xxx.xxx]"
    2025-07-15 00:55:16 SMTP INBOUND: "250-SIZE 36700160"
    2025-07-15 00:55:16 SMTP INBOUND: "250-8BITMIME"
    2025-07-15 00:55:16 SMTP INBOUND: "250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH"
    2025-07-15 00:55:16 SMTP INBOUND: "250-ENHANCEDSTATUSCODES"
    2025-07-15 00:55:16 SMTP INBOUND: "250-PIPELINING"
    2025-07-15 00:55:16 SMTP INBOUND: "250-CHUNKING"
    2025-07-15 00:55:16 SMTP INBOUND: "250 SMTPUTF8"
    2025-07-15 00:55:16 SERVER -> CLIENT: 250-smtp.gmail.com at your service, [169.44.xxx.xxx]250-SIZE 36700160250-8BITMIME250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH250-ENHANCEDSTATUSCODES250-PIPELINING250-CHUNKING250 SMTPUTF8
    2025-07-15 00:55:16 Auth method requested: XOAUTH2
    2025-07-15 00:55:16 Auth methods available on the server: LOGIN,PLAIN,XOAUTH2,PLAIN-CLIENTTOKEN,OAUTHBEARER,XOAUTH
    2025-07-15 00:55:16 CLIENT -> SERVER: QUIT
    2025-07-15 00:55:16 SMTP INBOUND: "221 2.0.0 closing connection 006d021491bc7-613d9d837f1sm1260332eaf.11 - gsmtp"
    2025-07-15 00:55:16 SERVER -> CLIENT: 221 2.0.0 closing connection 006d021491bc7-613d9d837f1sm1260332eaf.11 - gsmtp
    2025-07-15 00:55:16 Connection: closed
    Could not access file:

    It looks like, after authenticating, the plugin just closes the connection without sending the e-mail, and gives an error “Could not access file:” but no file name.

    What file is the plugin trying to access?

    Thanks.

    Thread Starter V Chappell

    (@vcchappell)

    I have several WordPress sites on one server.

    On the first site, I deleted the access token and then clicked “Grant Permission.” It took me to a Google signin and then asked me if I wanted to allow access. I did so, and it worked for that site.

    On the next site, I did exactly the same thing. Except when I clicked “Grant Permission” and logged into Google, it didn’t ask me if I wanted to allow access (I assume because I already did once?) but just took me back to the Gmail SMTP settings screens with the tabs, but nothing showing under the tabs. When I click on the “General” tab it says “Connected” in green at the top, but when I try to send a test e-mail I get the same “Could not authenticate” SMTP error.

    Thread Starter V Chappell

    (@vcchappell)

    Seems that WP Cerber was interfering with this plugin.

    Thread Starter V Chappell

    (@vcchappell)

    I am on WordPress 6.4.2 so this is not that problem.

    Thread Starter V Chappell

    (@vcchappell)

    Here’s why:

    Line 769 in /includes/core/controllers/class-assets.php

            $metabox_deps[] = 'autosave';

    Sets the ‘autosave’ script as a dependency of the wds metabox script. I guess you are piggybacking on some function provided by the autosave script?

    Anyway, deregistering the autosave script means the dependency is missing, thus the wds metabox scripts aren’t loaded.

    I’ve implemented a work-around, but this might help if you have other people reporting a similar problem.

    • This reply was modified 2 years, 5 months ago by V Chappell.
    Thread Starter V Chappell

    (@vcchappell)

    Try adding this code into your theme’s functions.php file:

    function disable_autosave() {
    wp_deregister_script('autosave');
    }
    add_action('admin_init', 'disable_autosave');

    This is the code to disable autosave on a site, per numerous online sources.

    When this code is present, the wds-* js scripts are not enqueued in the footer of the Edit Post / Edit Page when using the Classic Editor. For some reason, they are present when using the blocks/Gutenberg editor.

    I’m using the latest versions of the Classic Editor (1.63) and SmartCrawl (3.8.3) plugins.

    Thread Starter V Chappell

    (@vcchappell)

    Figured it out.

    Disabling ‘autosave’ for pages/posts causes this.

    Is there any way for the plugin to work when autosave is disabled?

    V Chappell

    (@vcchappell)

    Has the add-on been updated yet? Where do I download it?
    The version on the wp cerber website is still 1.1

Viewing 15 replies - 1 through 15 (of 16 total)