Title: Cannot Send Test Email after setup with Gmail API
Last modified: August 9, 2023

---

# Cannot Send Test Email after setup with Gmail API

 *  Resolved [John Smith](https://wordpress.org/support/users/docsmith16/)
 * (@docsmith16)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/cannot-send-test-email-after-setup-with-gmail-api/)
 * Hello All,
 * I am a first time user so I apologize in advance for when I screw this up. I 
   finished the plugin setup. However, I am getting the following error message.“
   Request is missing required authentication credential. Expected OAuth 2 access
   token, login cookie or other valid authentication credential.”
 * I went through the wizard step by step for the GMail API setup and received a
   success message. However, still no joy.
 * Thanks for your help.
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fcannot-send-test-email-after-setup-with-gmail-api%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Plugin Support [Victoria Sakal](https://wordpress.org/support/users/sakalvictoria/)
 * (@sakalvictoria)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/cannot-send-test-email-after-setup-with-gmail-api/#post-16964016)
 * Hi, [@docsmith16](https://wordpress.org/support/users/docsmith16/)!
 * Thanks for reaching out!
 * The error indicates that you haven’t performed an Authorization or it was broken
   for some reason.
 * Please, check it by following the next steps: go to the WP Mail SMTP plugin -
   > Settings -> scroll down and verify if the Authorization is performed (as on
   the screenshot [here](https://a.supportally.com/i/OFwAey)).
 * If not, perform the Authorization (please, look at the [screenshot](https://a.supportally.com/i/DoKPs8)).
 * If you’ll be facing some issues while this process, please, share the exact error
   message (screenshot of it) you are getting while performing the Authorization.
   And if you are redirected to another page while this process, share its URL.
 * Kind regards.
 *  Thread Starter [John Smith](https://wordpress.org/support/users/docsmith16/)
 * (@docsmith16)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/cannot-send-test-email-after-setup-with-gmail-api/#post-16966708)
 * Hello Victoria,
 * Thank you so much for your help. I have completed that step multiple times but
   no joy. I am still getting this error message.
 * **Heads up!** The last email your site attempted to send was unsuccessful.
 * > Email Source: Constant Contact Forms for WordPress Mailer: Google / Gmail {“
   > error”: { “code”: 401, “message”: “Request is missing required authentication
   > credential. Expected OAuth 2 access token, login cookie or other valid authentication
   > credential. See [https://developers.google.com/identity/sign-in/web/devconsole-project.&#8221](https://developers.google.com/identity/sign-in/web/devconsole-project.&#8221);,“
   > errors”: [ { “message”: “Login Required.”, “domain”: “global”, “reason”: “required”,“
   > location”: “Authorization”, “locationType”: “header” } ], “status”: “UNAUTHENTICATED”,“
   > details”: [ { “@type”: “type.googleapis.com/google.rpc.ErrorInfo”, “reason”:“
   > CREDENTIALS_MISSING”, “domain”: “googleapis.com”, “metadata”: { “service”: “
   > gmail.googleapis.com”, “method”: “caribou.api.proto.MailboxService.SendMessage”}}]}}
 * For more details please try running an Email Test or reading the latest [error event](https://sherryjsmith.com/wp-admin/admin.php?page=wp-mail-smtp-tools&tab=debug-events).
 * When I try to Send a Test Email the the Send Email button is grayed out with 
   this error message. “You cannot send and email. Mailer is not properly configured.
   Please check your settings.”
 * I have also noticed that the From Field is not populated with the email address.
 * When I went in to the setting on the WP Mail SMTP it does not show the OAuth 
   Connection has ever been made (authorized).
 * Thanks so much for your help.
 *  Plugin Support [Victoria Sakal](https://wordpress.org/support/users/sakalvictoria/)
 * (@sakalvictoria)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/cannot-send-test-email-after-setup-with-gmail-api/#post-16966811)
 * Hi, [@docsmith16](https://wordpress.org/support/users/docsmith16/)!
 * Thanks for following up!
 * You are getting the _“”code”: 401, “message”: “Request is missing required authentication
   credential. Expected OAuth 2 access token, login cookie or other valid authentication
   credential.”_ error because “Google / Gmail” mailer authorization is not performed.
 * Based on what I’ve seen, the “Constant Contact Forms for WordPress” plugin causes
   the conflict which prevents “Google / Gmail” mailer authorization.
 * Please, follow the next steps to perform the mailer authorization:
 * temporarily deactivate the “Constant Contact Forms for WordPress” plugin -> go
   to the WP Mail SMTP plugin and perform the authorization ([screenshot](https://a.supportally.com/i/NdzUt1))-
   > send a test email -> activate the “Constant Contact Forms for WordPress” plugin-
   > send a test email once more.
 * I hope this helps!
 *  Thread Starter [John Smith](https://wordpress.org/support/users/docsmith16/)
 * (@docsmith16)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/cannot-send-test-email-after-setup-with-gmail-api/#post-16967763)
 * Hello Victoria,
 * Thank you so much. I was zeroing in on the Constant Contact plugin being the 
   source of the problem, but I had disconnected instead of deactivated. As soon
   as I completed your instructions I was able to complete the authorization process
   successfully and send a test email. I was then able to reconnect the Constant
   Contact plug-in. The Constant Contact form is for our mailing list/newsletter
   subscriptions. I was able to subscribe successfully and an email notification
   to our company email generated properly. The developer we had used to build this
   site had used the gravity forms plug-in for the website contact form. It worked
   successfully and generated an email to our business email account. There is a
   third form plugin named Contact Form 7. I do not think this is being used but
   the Goodlayers/Kleaniity theme might require it. I don’t understand why we need
   so many different form plugins. Seems to me this is asking for trouble, but that
   is something I can deal with later. However a new problem has emerged. This is
   the message from the Send a Test Email page within the WP Mail SMTP plug-in.
 * The test email might have sent, but its deliverability should be improved.
 * Domain Check Results
 * ⌊error icon⌉⌊error icon⌉spf
 * **Action Needed**: It doesn’t look like the SPF record required by Google has
   been added to your domain. Please check out [Google’s SPF guide](https://support.google.com/a/answer/33786?hl=en&ref_topic=9061731)
   for details on how to add this record to your domain’s DNS.
 * ⌊warning icon⌉⌊warning icon⌉dkim
 * **Action Needed**: It doesn’t look like the DKIM record required by Google has
   been added to your domain. Please check out [Google’s DKIM guide](https://support.google.com/a/answer/174124?hl=en&ref_topic=2752442)
   for details on how to add this record to your domain’s DNS.
 * ⌊warning icon⌉⌊warning icon⌉dmarc
 * **Action Recommended**: It doesn’t look like DMARC has been set up on your domain(
   sherryjsmith.com). We recommend using the DMARC protocol because it helps protect
   your domain from unauthorized use. Please check out [our step-by-step guide](https://wpmailsmtp.com/how-to-create-dmarc-record/)
   for details on how to add this record to your domain’s DNS.
 * I have found the documentation that goes with each of these actions, however 
   when setting up the SPF, I am not sure whether I need the Basic Setup or the 
   Advanced Setup. Are the emails generated by the site only coming from our Google
   Workspace(Basic Setup), or are they also being generated by the Constant Contact
   and Gravity Forms? This may be a stupid question but I am still coming to grips
   with how everything plays together.
 * Thanks again for your help. You are a miracle worker. All the best.
 *  Plugin Support [Victoria Sakal](https://wordpress.org/support/users/sakalvictoria/)
 * (@sakalvictoria)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/cannot-send-test-email-after-setup-with-gmail-api/#post-16972291)
 * Hey, [@docsmith16](https://wordpress.org/support/users/docsmith16/)!
 * I’m glad to hear that you were able to perform the authorization successfully!
 * First of all, I’d like to share _the main purpose of the WP Mail SMTP plugin_.
 * Please kindly know, that the WP Mail SMTP bridges a connection between your WordPress
   site and your email mailing service ([chosen mailer](https://wpmailsmtp.com/categories/docs/mailers/)).
 * For example, you have a form on your website -> the user submits it -> sending
   of the notification email about the submission is triggered -> this email goes
   to the WP Mail SMTP plugin -> WP Mail SMTP plugin routes this email to the mailer-
   > mailer will send and deliver it further (so, emails from your site will be 
   sent by mailing service instead of your web host’s server. This improves the 
   reliability and efficiency of your email).
 * WP Mail SMTP uses the [wp_mail() function](https://developer.wordpress.org/reference/functions/wp_mail/).
   So, any emails sent through the wp_mail() function on the website will be routed
   through our plugin.
 * _How to add an SPF record for your sender domain_
 * If you are using a domain-based From Email address (e.g. [info@yourdomain.com](https://wordpress.org/support/topic/cannot-send-test-email-after-setup-with-gmail-api/info@yourdomain.com?output_format=md)),
   you’ll need to set up the needed DNS records (SPF, DKIM) for the sender domain(
   e.g. yourdomain.com).
 * _SPF record_
 * Add the 1 TXT record below:
 * `v=spf1 include:_spf.google.com ~all`
 * In the “@” box, add the domain for the site (e.g. yourdomain.com).
 * If you already have an SPF record added, you’ll need to merge them by following
   [this guide](https://wpmailsmtp.com/fix-multiple-spf-records/).
 * I hope it helps!
 * Best regards.
 *  Thread Starter [John Smith](https://wordpress.org/support/users/docsmith16/)
 * (@docsmith16)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/cannot-send-test-email-after-setup-with-gmail-api/#post-16974719)
 * Hello Victoria,
 * Thanks again for you help. Once I was able to determine that the were no other
   SPF records, I was able to finish with that part of the setup.
 * I am working on the DKIM authentication. The error message states “Email authentication
   was not verified. Please allow 48 hours for DNS to update and make sure you entered
   the correct TXT record into your domain provider’s DNS settings page.” If I am
   understanding things correctly, I wait 48 hours and log into the Google Workplace
   Admin Console, click start authentication and hope for the best. After that I
   will be able to tackle the DMARC recommended action. I will provide an update
   here on how things have gone.
 * Thanks again,
 *  Plugin Support [Victoria Sakal](https://wordpress.org/support/users/sakalvictoria/)
 * (@sakalvictoria)
 * [2 years, 10 months ago](https://wordpress.org/support/topic/cannot-send-test-email-after-setup-with-gmail-api/#post-16977723)
 * Hi, [@docsmith16](https://wordpress.org/support/users/docsmith16/)!
 * Thanks for letting me know! And I believe everything will be sorted.
 * I’m going to go ahead and close this thread for now. But if you’d need us to 
   assist further, please feel welcome to continue the conversation.
 * Have a great day! 🙂
 *  Thread Starter [John Smith](https://wordpress.org/support/users/docsmith16/)
 * (@docsmith16)
 * [2 years, 9 months ago](https://wordpress.org/support/topic/cannot-send-test-email-after-setup-with-gmail-api/#post-16978591)
 * Thank you again Victoria. SPF, DKIM, and DMARC have all passed in the Test Email
   action. I suspect I will want to change the DMARC settings in the future, since
   I used the generic provided. But I will fight that dragon another day.
 * Be well.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Cannot Send Test Email after setup with Gmail API’ is closed to new replies.

 * ![](https://ps.w.org/wp-mail-smtp/assets/icon-256x256.png?rev=1755440)
 * [WP Mail SMTP by WPForms - The Most Popular SMTP and Email Log Plugin](https://wordpress.org/plugins/wp-mail-smtp/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-mail-smtp/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-mail-smtp/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-mail-smtp/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-mail-smtp/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-mail-smtp/reviews/)

 * 8 replies
 * 2 participants
 * Last reply from: [John Smith](https://wordpress.org/support/users/docsmith16/)
 * Last activity: [2 years, 9 months ago](https://wordpress.org/support/topic/cannot-send-test-email-after-setup-with-gmail-api/#post-16978591)
 * Status: resolved