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.
Authorize Gmail locally
Section titled “Authorize Gmail locally”python -m pip install "mailatlas[keychain]"
mailatlas auth gmail \ --client-id "$MAILATLAS_GMAIL_CLIENT_ID" \ --client-secret "$MAILATLAS_GMAIL_CLIENT_SECRET" \Check status:
mailatlas auth status gmailSend a dry run first
Section titled “Send a dry run first”mailatlas send \ --provider gmail \ --dry-run \ --subject "MailAtlas Gmail dry run" \ --text "Rendered locally without contacting Gmail."Send through Gmail API
Section titled “Send through Gmail API”mailatlas send \ --provider gmail \ --subject "MailAtlas Gmail API test" \ --text "Sent with Gmail API OAuth." \ --idempotency-key gmail-api-test-1The idempotency key makes retries return the existing outbound record instead of sending a duplicate message.
Cleanup
Section titled “Cleanup”mailatlas auth logout gmailNext step
Section titled “Next step”- Use Gmail Provider for token storage details.
- Use Outbound Email for provider behavior and BCC handling.