Skip to content

Example: Gmail OAuth Send

This example shows the local Gmail API send path.

Use it when you want MailAtlas to send from a personal Gmail address or Gmail-configured send-as alias with the gmail.send OAuth scope.

Terminal window
python -m pip install "mailatlas[keychain]"
mailatlas auth gmail \
--client-id "$MAILATLAS_GMAIL_CLIENT_ID" \
--client-secret "$MAILATLAS_GMAIL_CLIENT_SECRET" \

Check status:

Terminal window
mailatlas auth status gmail
Terminal window
mailatlas send \
--provider gmail \
--dry-run \
--subject "MailAtlas Gmail dry run" \
--text "Rendered locally without contacting Gmail."
Terminal window
mailatlas send \
--provider gmail \
--subject "MailAtlas Gmail API test" \
--text "Sent with Gmail API OAuth." \
--idempotency-key gmail-api-test-1

The idempotency key makes retries return the existing outbound record instead of sending a duplicate message.

Terminal window
mailatlas auth logout gmail