MailDesk docs
Setup and administration

Enable faster Gmail synchronization

4 min read Odoo 18.0

A guided assistant in Odoo helps you switch on Gmail push, so new mail arrives in MailDesk within seconds instead of at the next scheduled sync.

Who this is for: MailDesk administrators, with help from whoever manages your Google Cloud project.

You need: MailDesk Pro, the Mailbox administrator access group, and a Google Cloud project you can administer (to enable APIs and create Pub/Sub topics, subscriptions and a service account).

Before you begin

  1. Connect the Gmail mailbox first and check that it syncs. See Connect Gmail / Google Workspace. Push reuses that connection and asks for no new permissions.
  2. Make your Odoo address public HTTPS. See Set up HTTPS for faster synchronization.
  3. Find out which Google Cloud project owns the OAuth client of the mailbox. The Pub/Sub topic must be in that same project.
  4. Do not switch off the MailDesk scheduled sync jobs. They are the fallback.

What push does

Google tells MailDesk that a mailbox changed. The notification does not contain the email. MailDesk then runs its normal sync for that mailbox. Mail arrives sooner, but not instantly.

All Google Cloud resources are created in your own project. MailDesk stores only your project id, the topic name, the signer service-account email, and the settings its webhook needs to verify notifications.

Set up Gmail push

Step 1: Open the assistant

  1. Go to MailDesk ▸ Configuration ▸ Mailboxes ▸ Mailbox Accounts and open the Gmail account.
  2. Click Configure Gmail Realtime in the form header. After setup, the same button is called Manage Gmail Realtime.

The Configure Gmail Realtime button in the header of a Gmail mailbox account

What you should see: a dialog with the steps Preflight, Choose mode, Run setup script, Paste result, Validate & enable, Run realtime test, Done.

Step 2: Run the preflight

Click Run preflight. The assistant checks, and shows OK or Action needed for each:

  • The account is a connected Gmail account with a usable OAuth token.
  • web.base.url is set and uses HTTPS.
  • The webhook can be reached from the internet.
  • The push renewal and fallback sync jobs are active.

The Preflight step shows each prerequisite as OK or Action needed

If a check fails, fix it as the screen says and click Run preflight again. For the reachability check, MailDesk expects HTTP 405 (see Set up HTTPS).

Step 3: Choose a mode

Mode Use it when What happens
Recommended Most setups MailDesk creates one script. You run it in Google Cloud Shell.
Advanced You already have the topic, push subscription and signer service account You enter the three values yourself.
Developer / Test Short tests with throwaway projects and tunnels Same script, with extra warnings.
  1. Enter your Google Cloud project id. The default names are maildesk-gmail-push (topic), maildesk-gmail-push-sub (subscription) and maildesk-pubsub-push (signer). Change them only if you have a naming rule.
  2. Copy the whole script, open Google Cloud Shell and run it. You can run it again safely.
  3. The script ends with a line that starts with MAILDESK_PUSH_RESULT=.

What you should see: the script prints six numbered phases and then the result line. For what each phase does, see Advanced: Google Cloud setup for Gmail push.

Step 5: Paste the result

  1. Click I've run the script.
  2. Paste the MAILDESK_PUSH_RESULT= line into the box and click Parse JSON.

In Advanced mode, type the three values and click Validate manually.

Step 6: Validate and enable

Click Enable Realtime. The assistant checks the public URL, the webhook, the audience, the topic and signer formats, saves the signer to the webhook's allow-list, and calls Gmail users.watch.

What you should see: the watch is saved and its expiry date is shown.

Step 7: Run the realtime test

Send a test email to the Gmail inbox from another address, wait a few seconds, and click Re-check. The timeline shows each stage as observed, missing or waiting. Click Finish.

What you should see: the realtime status of the account is Active, and new mail appears within seconds.

The watch lasts at most 7 days. MailDesk renews it automatically when less than 24 hours remain. You do not need to repeat the setup.

If it does not work

Symptom Likely cause Safe next step
Preflight: public URL check fails web.base.url is empty or http:// Set a public https:// address. See Set up HTTPS.
Preflight: webhook not reachable DNS, certificate, firewall or proxy problem Run the curl check on the HTTPS page.
Stops at the audience check The saved audience differs from the webhook address Run validation again. Do not change web.base.url meanwhile.
users.watch fails with a permission, "topic not found" or project error Google Cloud setup is incomplete or in the wrong project See Fix Gmail synchronization setup errors.
users.watch fails with an OAuth error The Gmail authorization expired or was revoked Reconnect the mailbox, then open the assistant again.
No fast mail after setup A notification was missed Mail still arrives on the scheduled sync. See Fix missing or delayed emails.

Next step

Fix missing or delayed emails if something looks wrong, or Gmail sync: connection and renewal to see how a Gmail mailbox is kept alive.