Skip to Content
SimulatorsGmailMailbox settings

Simulators

Mailbox settings

The settings routes hold the mailbox’s configuration, and nothing a setting says ever acts: an auto-reply, a forward or a filter’s action never leaves the simulator. Create a filter, switch on the vacation responder and read the aliases back:

curl -s -X POST "$RYSTIC_URL/_rystic/scenario" -d '{"name":"gmail_busy_inbox"}' -o /dev/null
G=(-H 'Authorization: Bearer ya29.placeholder')
curl -s "$RYSTIC_URL/gmail/v1/users/me/settings/filters" "${G[@]}" -o /dev/null -w '%{http_code}\n'
# -> 204
curl -s "$RYSTIC_URL/gmail/v1/users/me/settings/filters" "${G[@]}" -H 'Content-Type: application/json' -d '{"criteria":{"from":"billing@vendor.example"},"action":{"addLabelIds":["Label_11"],"removeLabelIds":["INBOX"]}}' | jq -c '{criteria, action}'
# -> {"criteria":{"from":"billing@vendor.example"},"action":{"addLabelIds":["Label_11"],"removeLabelIds":["INBOX"]}}
curl -s "$RYSTIC_URL/gmail/v1/users/me/settings/vacation" "${G[@]}" | jq -c '{enableAutoReply, responseSubject}'
# -> {"enableAutoReply":false,"responseSubject":""}
curl -s -X PUT "$RYSTIC_URL/gmail/v1/users/me/settings/vacation" "${G[@]}" -H 'Content-Type: application/json' -d '{"enableAutoReply":true,"responseSubject":"Away","responseBodyPlainText":"Back Monday."}' | jq -c '{enableAutoReply, responseSubject}'
# -> {"enableAutoReply":true,"responseSubject":"Away"}
curl -s "$RYSTIC_URL/gmail/v1/users/me/settings/vacation" "${G[@]}" | jq -c '{enableAutoReply, responseSubject, responseBodyPlainText}'
# -> {"enableAutoReply":true,"responseSubject":"Away","responseBodyPlainText":"Back Monday."}
curl -s "$RYSTIC_URL/gmail/v1/users/me/settings/sendAs" "${G[@]}" | jq -c '[.sendAs[] | {sendAsEmail, isPrimary, verificationStatus}]'
# -> [{"sendAsEmail":"ada.lovelace@example.com","isPrimary":true,"verificationStatus":"accepted"}]
curl -s "$RYSTIC_URL/gmail/v1/users/me/settings/language" "${G[@]}" | jq -c .
# -> {"displayLanguage":"en-US"}

Which settings are served

  • Filters are listed, created, read and deleted under …/settings/filters. Listing filters when there are none returns 204 No Content, as Gmail does, and so does listing forwarding addresses when there are none.
  • IMAP, POP, language and vacation are read and replaced whole with PUT.
  • Auto-forwarding is read.
  • Send-as addresses are listed, read and patched. PUT updates the primary address. On any other address it returns 403 forbidden, “Delegation denied for” followed by the mailbox’s own address.
  • Forwarding addresses are listed and read.

Scenarios that hold settings

gmail_filter_desk boots the Operations Desk’s four standing filters and the four messages they routed, so every label a filter action names resolves to a seeded label and seeded mail. gmail_vacation_relay boots two forwarding addresses and three send-as addresses, one of each still pending verification. Its vacation, IMAP, POP and auto-forwarding settings read back as their defaults (Limitations).

Last updated on