Customer setup guide

Connect MailMex to the Gmail API.

Create your own Google Cloud OAuth client, grant only the permissions MailMex needs, and connect each campaign sender securely.

Typical setup10–15 minutes
Client typeWeb application
Required APIGmail API
Extra servicesNo Pub/Sub required
i
MailMex does not create this project for you.
You control the Google Cloud project, OAuth consent configuration, and connected Gmail accounts.
00

Before you begin

Collect the two values that must match later.

Open your deployed MailMex Campaign page, select a task, enter its sender email, and open the Gmail setup dialog. Keep the exact callback URL shown there available.

Development callback example

http://localhost:8001/app/google-callback

Production callback pattern

https://YOUR-MAILMEX-DOMAIN/app/google-callback
!
Use the callback displayed by the MailMex application, not this marketing website. Production callbacks must use HTTPS and match exactly, including scheme, host, path, and port.
01

Create a Google Cloud project

Keep MailMex credentials isolated and under your control.

  1. Open the Google Cloud Console and sign in.
  2. Open the project selector in the top navigation and choose New project.
  3. Enter a recognizable name such as MailMex Gmail, choose the correct organization if applicable, and create the project.
  4. Wait for creation to finish, then make sure the new project is selected.
Animated walkthrough highlighting the Google Cloud project selector, project name, and Create button
Create and select the project that will own your MailMex OAuth client.
The project name is only for your Cloud Console. Your consent-screen app name is configured separately.
02

Enable Gmail API

MailMex sends messages and checks delivery notices through Gmail REST API.

  1. In Google Cloud Console, open APIs & Services → Library.
  2. Search for Gmail API and open the Google result.
  3. Select Enable.
Animated walkthrough showing Gmail API search and the Enable button
Search for Gmail API, open its card, and enable it.

You do not need Cloud Pub/Sub, a service account, an API key, IMAP, or SMTP for the MailMex Gmail connection.

03

Configure OAuth branding

These details appear when a sender grants access.

  1. Open Google Auth Platform → Branding. If prompted, choose Get started.
  2. Enter an app name that identifies your organization’s MailMex installation.
  3. Select a monitored user-support email and add developer contact information.
  4. For production, add your homepage, Privacy Policy, and Terms links and configure only domains you own.
Animated walkthrough highlighting Branding, Audience, and Data Access in Google Auth Platform
Branding, Audience, and Data Access are separate areas in the current Google Auth Platform.
https://YOUR-MARKETING-DOMAIN/privacy.html https://YOUR-MARKETING-DOMAIN/terms.html
04

Add MailMex permissions

Declare the same minimum scopes that MailMex requests.

Open Google Auth Platform → Data Access, choose Add or remove scopes, and add these Gmail permissions:

ScopeWhy MailMex needs it
https://www.googleapis.com/auth/gmail.sendSend each campaign message through the connected Gmail account.
https://www.googleapis.com/auth/gmail.readonlyRead relevant delivery-failure notices for Delivery Health checks.

Google sign-in also supplies the basic openid and email identity scopes. Do not add broad mailbox permissions that MailMex does not request.

Why not use only gmail.modify?

gmail.modify can replace both scopes functionally: it can read, compose, and send mail. It also authorizes mailbox modifications that MailMex does not need. The current MailMex authorization request explicitly asks for gmail.send and gmail.readonly, so your Data Access configuration must declare those same scopes. Use gmail.modify only if the MailMex application is intentionally changed to request and use it.

05

Choose your audience

Decide who can connect a sender while you test.

Internal

Choose Internal when the app is owned by a Google Workspace organization and only people in that organization will connect. Personal Gmail accounts cannot use an Internal app.

External

Choose External for personal Gmail accounts or senders outside your Workspace organization. While the app remains in Testing, add every sender address under Audience → Test users.

!
Google says test-user authorizations expire after seven days while an External app is in Testing. A sender may need to reconnect until the app is published.
06

Create a Web OAuth client

The downloaded JSON is what MailMex validates and stores securely.

  1. Open Google Auth Platform → Clients and choose Create client.
  2. Select application type Web application.
  3. Give it a descriptive name, such as MailMex Web.
  4. Under Authorized redirect URIs, add the exact MailMex callback collected in Step 00.
  5. Create the client, then download its JSON file.
Animated walkthrough highlighting Web application, redirect URI, and Create client
Choose Web application and paste the callback exactly as MailMex displays it.

MailMex expects a Web application JSON containing client_id, client_secret, project_id, and at least one valid redirect_uri. The file must be smaller than 64 KB.

No Authorized JavaScript origin is required for MailMex’s server callback flow.
07

Upload and connect in MailMex

Finish the two-part setup for the selected campaign task.

  1. In MailMex, open Campaign and select the task you want to configure.
  2. Enter the sender’s exact Gmail or Google Workspace email address.
  3. Open Gmail setup and choose the downloaded Web application OAuth JSON.
  4. After MailMex confirms the JSON, choose Continue with Google.
  5. Sign in as the same sender, review the permissions, and allow access.
  6. Return to MailMex and confirm the task shows Connected.
Animated walkthrough showing OAuth JSON upload, Continue with Google, and Connected status in MailMex
Upload the Web client JSON, authorize the matching sender, and check for Connected status.
i
Each task has an independent sender and OAuth connection. Repeat the upload and authorization for every task you use. The same sender cannot be assigned to multiple tasks.
08

Prepare for production

Testing mode is suitable for setup—not a permanent public launch.

  • Use an HTTPS MailMex callback on a stable domain.
  • Publish working homepage, Privacy Policy, and Terms pages on verified domains.
  • Keep project-owner and developer-contact addresses monitored.
  • Request only the scopes documented above and describe their use accurately.
  • If people outside your Workspace organization will connect, review Google’s current verification requirements in the Verification Center.
  • Consider separate Google Cloud projects for development and production.
09

Troubleshooting

Fast checks for the most common connection failures.

Error 400: redirect_uri_mismatch

Copy the callback shown by MailMex again and compare it with the OAuth client’s Authorized redirect URI character by character. Check HTTP versus HTTPS, port, hostname, path, and trailing slash.

Access blocked or Error 403: access_denied

If the app is External and in Testing, add the sender under Audience → Test users. If it is Internal, the sender must belong to the owning Workspace organization.

MailMex rejects the JSON file

Download the OAuth client again and confirm its application type is Web application. Do not upload an API key, service-account key, Desktop client, or a renamed non-JSON file.

Gmail disconnects after seven days

This is expected for External apps left in Testing. Reconnect the sender while testing or complete the steps required to publish the OAuth app.

Delivery Health cannot inspect bounces

Confirm gmail.readonly is declared under Data Access, then disconnect and reconnect Gmail so the sender grants the newer permission.

Connected sender is not the address entered

Disconnect the task and repeat authorization while signed in to the exact sender address. The OAuth identity must match the address configured for that task.

Your Gmail sender is ready.

Return to MailMex, import a small test audience, and send a controlled test campaign before using a production list.

Open MailMex