Python
Changelog
Every release of the package, newest first.
0.1.0
- To-dos: a to-do list is a calendar of kind
todos(CALENDAR_KINDS.TODOS), and its items are RFC 5545 to-dos that calendar apps such as Reminders, Thunderbird and tasks.org sync over CalDAV.calendar.list_todos,list_all_todosanditerate_todosread them throughGET /calendar/todos, filtered bycalendar_ids=,state=(TODO_STATES, typedTodoState:open,doneorall),due_before=anddue_after=.get_todo,create_todo(TodoCreate),update_todo(TodoPatch) anddelete_todo(DeletedTodoResource, with how many to-dos itremoved) work on one. ATodoResourcehas atitle,notes, astatusfromTODO_STATUSES(typedTodoStatus),startanddueas a day or a moment withallDayandtimezone,completedAt,priority,percentComplete,categories, theparentIdof the to-do it is a step of and therecurrenceit repeats by.startandduetake adatetimeor a string, anddue_before=anddue_after=adatetimeor an ISO 8601 string. Checking off a repeating to-do moves it to its next date. They are onNextmailandAsyncNextmail, and needcalendar:readandcalendar:write. calendar.list_calendarstakeskind=and lists your to-do lists withkind='todos', andcalendar.create_calendartakeskindto make one. Members, colours, order and deleting work on to-do lists as they do on calendars.calendar.delete_calendartakesnotify_guests=: left out orTrue, the guests of every upcoming meeting you organised in the calendar are sent a cancellation, ascancel_eventdoes, andFalsedeletes it without telling anyone.DeletedCalendarResourcecarriescancelledMeetings. Sending the cancellations needsemails:sendas well.calendar.list_calendar_logins,create_calendar_login,revoke_calendar_loginandcreate_calendar_login_profile_linkmanage calendar sign-ins, through/calendar/logins. A calendar sign-in belongs to a person, not to an address: its username iscal-and ten letters and digits, never an address, and it signs calendar and contacts apps in over CalDAV and CardDAV to that person’s calendars, the calendars and address books shared with them and their contacts, even when they hold no address at all. Mail apps refuse it and it never sends.create_calendar_loginreturns aCreatedCalendarLoginResourcewith the password shown once,servers(CalendarLoginServers) and an Apple configuration profile with CalDAV and CardDAV only, andcreate_calendar_login_profile_linkreturns a one-time link that makes one on an Apple device (CalendarLoginProfileLinkResource). Your own takeaccount:readandaccount:write, andmember=onlist_calendar_logins, ormemberin the body (CalendarLoginCreate,CalendarLoginProfileLinkCreate), reaches a member’s withmembers:write. Neither create is retried automatically. They are onNextmailandAsyncNextmail.SECURITY_EVENT_KINDSgainsCALENDAR_LOGIN_CREATED('calendar-login-created') andCALENDAR_LOGIN_REVOKED('calendar-login-revoked'), typed inSecurityEventKind, andSecurityEventDetailgainslogin, the username of the sign-in an entry is about.threads.list_automationsreads which automations ran on a thread and what they did, throughGET /threads/{id}/automations: alist[ThreadAutomationRunResource], newest first, each with theautomationit was (ThreadAutomationRef), itsstatus,trigger, the case the email matched (ThreadAutomationMatch: the address or domain that received it, the sender entry and the filters that held), themessagesof the thread it started from or sent (ThreadAutomationMessage, itsroleone ofAUTOMATION_THREAD_ROLES, typedThreadAutomationRole) and every step it ran (ThreadAutomationStep, with the step as the version defines it). It is onNextmailandAsyncNextmail, and needsthreads:readandautomations:read.live_events.streamfollows the mailbox as it changes, without polling. It yields an event, typed asLiveEventResource, each time a message is filed for an address (message.received) or sent from one (message.sent), a conversation gains or loses labels (thread.changed) or is deleted for good (thread.deleted), and the delivery of a sent email moves on (message.status_changed, with astatusfromLIVE_SEND_STATUSES). It takestypes(values ofLIVE_EVENT_TYPES),addressandlast_event_id, and is a generator onNextmailand an async generator onAsyncNextmail. When the server closes the stream or the connection drops, it opens it again and resumes throughLast-Event-ID, and when it cannot resume it yields aresetevent whosereasonis one ofLIVE_RESET_REASONS. A network failure, a 408, a 429 and a 5xx are retried with backoff for as long as you read, a connection silent for 60 seconds is opened again, any other refusal raisesNextmailApiError, and breaking out of the loop, closing the generator or cancelling the task closes the connection.threads.wait_for_emailwaits for a message that matchesfrom_,subjectandaddressto arrive aftersince, for up totimeoutseconds (0 to 60, 30 when left out), and returns aMessageWaitResourcewhosemessageis aMessageArrivalResource, orNonewhen nothing came in time. The call may taketimeoutplus 15 seconds, whatever the client’stimeoutis.ADDRESS_FORWARD_STATUSESgainsBOUNCED('bounced'): a forwarding destination whose server refused forwarded mail for good, so nothing is forwarded to it until it confirms again. A route that forwards to one readsforward_bounced(ADDRESS_ROUTE_INACTIVE_REASONS.FORWARD_BOUNCED). Asking a bounced destination again sends it a new confirmation.TrafficVerdictsandWebhookRoutedVerdictscarryarc: the ARC verdict for the servers that forwarded the message on its way in,pass,fail,noneortemperror, andNoneon an entry written before ARC was checked.calendar.list_calendars,get_calendar,create_calendar,update_calendaranddelete_calendarmanage your calendars (CalendarResource,CalendarCreate,CalendarPatch): the ones you keep, with your default one among them, and the ones other members of the workspace gave you access to, each with its owncolorandposition. Deleting a calendar deletes its events, and your default calendar cannot be deleted.calendar.set_calendar_member(id, member_id, body)andremove_calendar_member(id, member_id)give a memberreadorwriteaccess to a calendar you keep (MemberAccessSet,COLLECTION_ACCESS_LEVELS, typedCollectionAccess), andaccesson a calendar says what you may do with it (COLLECTION_RIGHTS, typedCollectionRight). A calendar’skindis one ofCALENDAR_KINDS, typedCalendarKind.set_calendar_memberis safe to repeat.CalendarEventResourceandCalendarOccurrenceResourcecarrycalendarId.create_eventtakescalendarIdto put the event in a calendar,update_eventtakes it to move one,list_events,list_all_eventsanditerate_eventstakecalendar_ids=to keep only some calendars,create_feedtakescalendarIdto publish one calendar (andCalendarFeedResourcesays which), andimport_icstakescalendar_id=for the calendar the events go into.contacts.list_address_bookslists your address book and the ones other members gave you access to (ContactAddressBookResource).contacts.set_address_book_member(id, member_id, body)andremove_address_book_member(id, member_id)give a memberreadorwriteaccess to yours.list_cards,list_all_cardsanditerate_cardstakeaddress_book=to read one you are a member of, andcreate_cardtakesaddressBookto add to one you may write.traffic.list,list_allanditerateread the traffic log: one entry for each message and recipient at each step it took in or out of the workspace, newest first, kept for 30 days. They takedomain_id,direction,outcomes,address,recipient,sinceanduntil. Outbound entries needemails:readand inbound onesthreads:read.emails.send_rawsends an RFC 5322 message you built yourself, as written:rawis its bytes, encoded for you, or a base64 string, up to 10 MB. The sender is its From header and the recipients its To, Cc and Bcc headers, unlessto,ccorbccgive the envelope. It takes the scheduling, tracking, signature, tag and lane options ofsend, honoursidempotency_key=, and never sends a Bcc header.- The
email_receivedtrigger of an automation takessenders, the addresses or domains its mail has to come from, where a domain covers its subdomains. Left out or empty, mail from anybody starts it. settings.updatetakeslabelAlerts, andsettings.getreturns it: label ids under each workspace id whose mail still alerts you while labelled mail stays out of your inbox.MAILBOX_PROVIDERSandMAIL_SERVICESgainOPENEMAIL('openemail'), the provider of a mailbox on OpenEmail and thesentWithof a message sent with it.sentWithstays empty, rather than naming Outlook or Gmail, when another mail service signed the message and the only hint is that it passed through Microsoft’s or Google’s servers on the way or was written in the Outlook app.share_links.list,list_allanditerateread the templates, forms and automations the workspace shares at a public link (ShareLinkResource), the newest first, with how often each page was opened and each item copied, and takekind=(SHARE_KINDS, typedShareKind).share_links.get(kind, item_id)reads the link of one item, andshare_links.set(kind, item_id, body=None)makes it public or changescopyable(ShareLinkSet) and is safe to repeat.share_links.delete(kind, item_id)makes it private again (DeletedShareLinkResource). A private item answers 404share_link_not_found.shared.get(token)reads what the public page of a link shows, from any workspace (SharedItemResource, withSharedTemplate,SharedFormorSharedAutomationfor its kind), andshared.copy(token)copies the item into this workspace as a draft (SharedCopyResource). It is never retried, because a second call makes a second copy. An item its owner shares to look at only answers 403share_not_copyable, and a link that no longer works answers 404shared_item_not_found.tasks.list,list_allanditeratetakechat_id=to read only the tasks made in one assistant chat, the ones the chat shows above its messages, as the Tasks page does when a chat’s task is opened. A chat belongs to one person, so the id of a chat you cannot open lists no tasks.
0.0.1
The first release of the Python package. It has a method for every one of the 746 methods of the TypeScript SDK, in 53 namespaces, each under its TypeScript name in snake_case, and a parity check in the package’s own build proves that every one sends the same request as its TypeScript twin.
- Two clients with the same methods and arguments:
Nextmail, which blocks, andAsyncNextmail, which is awaited and runs on asyncio and on trio. Each has an attribute for every namespace, fromemails,threadsandtemplatestoautomations,bookingsandconnected_mailboxes. - A request body is a dict whose keys keep the API’s camelCase names, the options of a call are snake_case keyword arguments such as
idempotency_key=andlimit=, and a response comes back as a dict. Every body, result and webhook payload has aTypedDictinnextmail.types, so a type checker catches a misspelt key. - A client takes an API key or an OAuth access token, or reads
NEXTMAIL_API_KEY,NEXTMAIL_ACCESS_TOKENandNEXTMAIL_BASE_URL.access_token=also takes a function that returns the token, called before every request, which may be async onAsyncNextmail.base_url,timeout,max_retries,headers,user_agentandhttp_client, your ownhttpxclient, set the rest. Every method also takestimeout=for one call, andapi_key=, orinbox_token=ontemp_mail, to act with another credential. - Every workspace is the same kind, the one that holds the free address included. That address sends only the mail a person writes in the app, so a send from it with an API key or an access token is refused with
from_address_forbidden. from nextmail import nextmailis a ready-made client, built from the environment the first time it is touched, andinit(...)configures it once at startup.create_temp_mail()andcreate_async_temp_mail()open disposable inboxes with no credential.- Every paginated resource has
listfor one page,list_allfor every item as a list, anditerate, which yields each item and fetches the next page only when it gets there. - An API refusal raises
NextmailApiError, withstatus,type,code,param,doc_url,request_id,retry_after_secondsandfields, and checks such asis_validation,is_not_found,is_rate_limited,is_step_up_requiredandis_retryable. No response at all raisesNextmailNetworkError, withis_timeoutwhen the deadline passed. Both derive fromNextmailError, and a mistake in the call itself raisesValueErrorbefore anything is sent. - Reads, sends and every write that is safe to repeat are retried on 408, 500, 502, 503 and 504 with backoff, and on a 429 only when its
Retry-Afteris a minute or less. A send carries an idempotency key that its retries reuse, so a retry never sends a second message.timeoutbounds a whole attempt, the response body included, and uploads wait at least ten minutes. verify_webhook_signaturechecks a delivery in constant time, refuses one more than five minutes old and returns the parsed event, or raisesWebhookVerificationError.- The helpers of the TypeScript SDK are here too, such as
to_base64andresolve_language, and every value set it exports is a constant innextmail.constants, such asWEBHOOK_EVENTSandAPI_SCOPES. client.raw.request()reaches any endpoint with the client’s credential, base URL, timeout and retries, and a credential is never sent over plain HTTP, except to a server on this machine.- When a newer version is on PyPI, the client says so once, on a terminal only.
disable_update_notice=TrueorNEXTMAIL_DISABLE_UPDATE_NOTICE=1turns that off. - It needs Python 3.10 or newer and depends only on
httpx,anyioandtyping-extensions. - API keys begin
nm_live_ornm_test_, and temporary inbox tokensnm_inbox_. The client refuses a key of any other shape. - Images up to 100 MB go in on
account.set_photo,contacts.set_photo,domains.set_address_photo,bookings.upload_background,branding.upload_imageandtemplates.upload_image. Each also takescrop=, the part of the image to keep as anImageCropof fractions, and waits as long asfiles.uploaddoes. emails.list_events_by_message_id,list_all_events_by_message_idanditerate_events_by_message_idread the event trail of a sent email found by the Message-ID header it went out with, for a caller that holds that header and not themsg_id, such as a reply or a bounce report that quotes it. They take the Message-ID as their first argument, sent asmessageId, withlimit=,cursor=andaddress=as onlist_events. A Message-ID that no message the key reaches went out with is a 404.provider_imports.list,list_allanditeratetakesource=(one ofPROVIDER_IMPORT_PROVIDERS, typed asProviderImportProvider),status=(one ofIMPORT_HISTORY_STATUSES, typed asImportHistoryStatus) andsearch=, up to 320 characters, the filtersimports.listtakes, sent with every page. An import from a provider never pauses, sostatus='paused'answers an empty page.emails.list_events,list_all_eventsanditerate_eventstakemessage_id=, 1 to 998 characters, sent asmessageId: the trail answers only when the send went out with that Message-ID header, with or without its angle brackets, and is a 404 otherwise. The send id is still required.files.create_linktakesreuse=:Truehands back the working public link the file already has, with its own domain and download count, instead of making another, and a file with none gets a new one. A link handed back answers 200 and a new one 201.keys.create,updateanddelete,keys.rotatefor any key but the caller, andworkspaces.offer_ownership,withdraw_ownership_offer,account.accept_ownership_offeranddecline_ownership_offerrefuse an API key with 403console_only,ERROR_CODES.CONSOLE_ONLYinnextmail.constants. The console confirms these changes with a verification code, which a key cannot give, so they are made there. A key still rotates its own secret withkeys.rotateorme.rotate, and revokes keys withkeys.revoke.app_host.get,setandverifyreturnsender, typed asAppHostSenderinnextmail.types: where the emails sent to the people of the workspace come from, a dict withaddress,domainandwaitingOn.waitingOnislogoorsigning, one ofAPP_HOST_SENDER_WAITSand typed asAppHostSenderWait, until they come fromnoreply@the domain of the live web app address, thenNone.senderisNoneon the free plan and until an address on a verified domain of the workspace is live.addresses.list,list_allanditerategive each address arole, one ofADDRESS_ROLESand typed asAddressRole:owneron every address for an API key, andmemberorviewerfor an app a member connected. A key narrowed to particular addresses or domains lists only the addresses and domains it covers, and the free address of the person the key acts for is listed, withroleset toowner, by a key of the workspace it belongs to.chats.send_messagesays something in a chat with the assistant, or starts one, and returns the turn once the assistant has replied, typed asChatTurnResourceinnextmail.types: itsstatus, one ofCHAT_TURN_STATUSES, themessagesit added,stopReasonand thependingToolCallsthat wait for an answer.chats.approve_tool_callruns one, withargslaid over the ones the assistant chose,chats.deny_tool_callrefuses one, andchats.stop_turnstops a turn and answersstoppedoridle, fromCHAT_STOP_STATUSES. The three calls that wait for the assistant wait up to 300 seconds, or the client’stimeoutwhen that is longer, unlesstimeout=says otherwise, andtimeout=0waits as long as it takes. None of the four is retried. The refusals are 409chat_busyandapproval_pending, 403tool_not_offeredand 503assistant_unavailable.chats.list_messages,list_all_messagesanditerate_messagesread the messages of a chat, from the first or, withorder='desc', from the newest, each with itstextand itsparts, typed asChatMessageResource.CHAT_MESSAGE_ORDERS,CHAT_MESSAGE_ROLES,CHAT_MESSAGE_PART_TYPES,CHAT_TOOL_CALL_STATUSESandCHAT_STOP_REASONShold the values.members.get_directory_sync,connect_directory_syncanddisconnect_directory_syncread, turn on and turn off directory sync (SCIM), through which a company directory adds people and takes them out again.connect_directory_syncreturns the token once.members.list_directory_peoplepages through the people it synced withstart_index=andcount=, each in one ofDIRECTORY_PERSON_STATES, andmembers.set_directory_default_roleandset_directory_group_rolechoose the roles it gives. Only the owner or a role holdingworkspace:managereaches them, and every change asks an OAuth access token for a verification code.security.get_policyandsecurity.update_policyread and set whether everyone in the workspace has to sign in with two-factor authentication, typed asSecurityPolicyResource.get_policyneeds no scope and also says whether the person behind the client meets the rule, andupdate_policyneedsmembers:writeand a verification code.workspaces.get_ownership_offer,offer_ownershipandwithdraw_ownership_offeroffer the workspace to one of its members, andaccount.list_ownership_offers,accept_ownership_offeranddecline_ownership_offeranswer an offer. Offering and accepting ask for a verification code.account.set_namechanges the name of the person.account.list_push_devices,remove_push_deviceandsend_test_pushread and manage the phones that get their notifications, withplatformfromPUSH_PLATFORMS, andaccount.end_connected_app_elevationmakes a connected app ask for verification codes again.threads.set_replyingandclear_replyingshow the team that you are writing a reply.threads.list_trackingreads how the mail sent in a thread was read,threads.get_deliverywhether it arrived, typed asThreadDeliveryResource, andthreads.list_file_links,list_all_file_linksanditerate_file_linksthe download links one message carried, withinclude_revoked=.threads.countstakeshide_labelled=.senders.get_avatarreturns the picture found for a sender asbytes, andsenders.getandresearchreportavatarUrlandavatarKind, one ofSENDER_AVATAR_KINDS.dns_connections.startreturns the link that connects a Cloudflare account in a browser,domains.start_gravatar_publishthe link that publishes the photo of an address to Gravatar, anddomains.create_mail_app_profile_linka one-time link that sets an address up on an Apple device.emails.sendandemails.send_batchtakeisForwardandoriginalMessage, the email being forwarded or answered, quoted below the body, andencryption, typed asSealedMessageInput, for a message you sealed yourself with OpenPGP.emails.translatetakesskipQuotedand reportsquotedHistoryKept.emails.get_tracking,list_events,list_all_eventsanditerate_eventstakeaddress=, and so dotracking.list_opens,list_clicksand their walks.tracking.list,list_allanditeratetakeoffset_minutes=, andtracking.get_statsreportsdownloads, typed asTrackingDownloads.contacts.list,list_allanditeratetakeaudience_id=, andcontacts.activitytakesfrom_=andto=.audiences.list_contactsand its walks takeinactive_days=.audiences.growth,bookings.analyticsandforms.analyticstakesince=anduntil=, andbroadcasts.analyticsandbroadcasts.statstakesince=.imports.listand its walks takesource=,status=, one ofIMPORT_HISTORY_STATUSES, andsearch=,rules.list_runsand its walks takerule_ids=, andsignatures.listand its walks takefrom_=.audiences.add_contactandcontacts.set_audiencestakecreateContact, which saves an address that is not a contact yet first and needscontacts:write. Through an app a member connected, an address another member saved is a 409contact_existsthere and oncontacts.save.templates.updateandtemplates.replace_contenttakeexpectedUpdatedAt, andtemplates.publishtakesexpected_updated_at=: theupdatedAtevery template version reports. A draft saved again in between is a 409version_conflict.drafts.createanddrafts.updatetakeattachments: inline files of up to 5 MB, withcontentasbytesor base64, or stored files byfileId. Every draft attachment reportsfileId.- An attachment given as
{'url': ...}is sent as it is, with itsfilenameandcontentTypewhen they are set. - Scopes:
addresses.listand its walks needemails:readoremails:send,audiences.list_contactsand its walks needcontacts:readtoo,emails.compose,rewrite,suggest_subjectandtranslatetakedrafts:writein place ofemails:send,domains.get_mail_app_settingsandlist_app_passwordsneedthreads:read, anddomains.update_mail_app_settingsneedsthreads:readas well asdomains:write.domains.create_addressasks an OAuth access token for a verification code when it chooses where the mail goes or deletion on expiry. domains.create_addressanddomains.update_addresstakeexpiresAtandonExpiry, one ofADDRESS_EXPIRY_ACTIONS, and every address reports them withexpiredAt. From itsexpiresAtan address takes no mail and sends none, a send from it is refused with 403address_expired, and within a minute it is switched off, or deleted with the conversations delivered to it whenonExpiryisdelete. A laterexpiresAt,Noneorenabledset toTrueturns a stopped address back on.WEBHOOK_EVENTS.ADDRESS_EXPIREDis the eventaddress.expired, typed asAddressExpiredEventDatainnextmail.types.DOMAIN_ADDRESS_DESTINATIONSincludesWEBHOOKandGROUP. The same two methods takewebhookIdfor a webhook destination,tapWebhookIdsto copy every message to up to 5 endpoints, andgroupPosting, one ofADDRESS_GROUP_POSTING_POLICIES, andgroupKeepCopyfor a group, and every address reports them. The refusals arewebhook_not_foundandtoo_many_taps.WEBHOOK_EVENTS.EMAIL_ROUTEDis the eventemail.routed, typed asEmailRoutedEventData: a message that arrived at an address whose destination iswebhook, or that a route of its domain sent to a webhook, was kept for 30 days instead of being filed. It goes only to the endpoint the address or route names and to the taps of the address, and always carriescontentandraw.routedBy, whosekindis one ofWEBHOOK_ROUTED_SOURCES, says which sent it,recipientkeeps the plus tag andverdictsare what the receiving server found. Anemail.receivedevent carriestap,Truewhen an endpoint gets the message as a tap of the address rather than through its subscription.domains.list_routes,list_all_routesanditerate_routesread the pattern routes of a domain in the order they are tried, typed asAddressRouteResourceinnextmail.types.domains.create_route,get_route,update_routeanddelete_routemanage them: a route catches mail to addresses nobody created whose local part matches itspattern, such assupport-*, and delivers it to an address, forwards it once the destination confirms, posts it to a webhook asemail.routedor reads it on another domain, the actionsADDRESS_ROUTE_ACTIONSlists.activeandinactiveReason, one ofADDRESS_ROUTE_INACTIVE_REASONS, say whether a route takes mail now. A domain holds at most 100 routes, and the refusals areinvalid_route_pattern,route_pattern_taken,route_target_not_foundandroute_limit_reached.domains.test_routeanswers which step decides mail to an address without sending anything, one ofADDRESS_ROUTE_TEST_STEPS, with the route that decided and where the mail would go, typed asAddressRouteTestResource.domains.list_group_members,list_all_group_membersanditerate_group_membersread the group members of a group address, typed asGroupMemberResource, anddomains.add_group_membersandremove_group_memberchange them. A group member is an address of the workspace or an address at another provider, which confirms by email first, the kindsGROUP_MEMBER_KINDSlists. A group holds at most 1,000 group members and groups nest at most 3 deep, and the refusals arenot_a_group,group_member_limit,group_member_not_foundandgroup_nesting_too_deep.domains.updatetakesaliasOf, which makes the domain an alias of another domain of the workspace, and every domain reportsaliasOfandaliases, typed asDomainAlias. The refusals arealias_not_allowed,alias_chainandalias_has_addresses, and creating an address on an alias is refused withalias_has_addresses.domains.update_address_limitstakesreceiving['storageBytes'], a storage quota for one address from 1 MiB to 1 TiB, and the limits report it. A message that would take the address past its quota gets a permanent bounce (5.2.2), and deleting mail for good makes room again.domains.get_address_limitsreports what the address keeps inusage['storage'], withbytesandmessages, typed asAddressStorageUsageinnextmail.types. Mail stored before storage counting began and mail routed to a webhook are not counted.webhooks.list_dead_letters,list_all_dead_lettersanditerate_dead_lettersread the events an endpoint gave up on: each event whose last automatic attempt failed, with how many times it was tried, the last answer and that attempt, typed asWebhookDeadLetterResource.status=reads theopenones by default, orreplayed,discardedorallfromWEBHOOK_DEAD_LETTER_FILTERS, andWEBHOOK_DEAD_LETTER_STATUSESholds the statuses a dead letter can have. A dead letter is kept 30 days.webhooks.replay_dead_letterssends up to 100 open dead letters again in one call, the ones named inbody['ids']or the oldest, and returns anoutcomefor each fromWEBHOOK_DEAD_LETTER_REPLAY_OUTCOMES. A delivered one is closed asreplayed.webhooks.discard_dead_lettercloses one without sending it, and one already replayed is 409dead_letter_resolved.webhooks.createandwebhooks.updatetakeretryPolicyfromWEBHOOK_RETRY_POLICIES:standardtries a failed delivery up to 8 times over about 27 and a half hours, andextendedup to 16 times over about 3 days. They also takeincludeRaw, which needsthreads:read, and every endpoint reports both.threads.get_raw_messagereturns the source of one message asmessage/rfc822bytes, ready to save as an.emlfile. It is the message byte for byte as it arrived when the address hadkeepOriginalon, and otherwise a source rebuilt from the stored message, the same bytes the IMAP server gives a mail app. TheX-Message-Sourceresponse header says which, one ofRAW_MESSAGE_SOURCES.domains.create_addressanddomains.update_addresstakekeepOriginal, and every address reports it. While it is on, each message the address receives is also kept byte for byte as it arrived, and it is deleted with its message.- An
email.receivedevent to an endpoint withincludeRawon carriesdata['raw'], typed asWebhookMessageRaw: a link that downloads the message source for an hour, itssizeand itssource,originalorrebuilt. domains.get_address_limitsanddomains.update_address_limitsread and change what one address may send and receive: a hold that pauses or disables sending or receiving, caps per hour, per 24 hours and per month on messages and recipients, recipients per message, and lists of allowed and blocked recipients and allowed senders, with the usage so far.ADDRESS_HOLDSlists the holds.domains.getanddomains.updategive each DNS recordfound, what public DNS answers at that name now, andproblem, a dict with acodefromDOMAIN_RECORD_PROBLEMSand amessageto show a person.domains.updatetakesautodiscoveryin the patch:Trueoffers the SRV and TXT records that let mail, calendar and contacts apps find the servers from an address on the domain alone, listed inautodiscoveryRecords.webhooks.createandwebhooks.updatetakeincludeContent, which puts the message into everyemail.receivedevent asdata['content']: the text, the HTML up to 512 KiB and each attachment with a link that downloads it for an hour. Turning it on needsthreads:read.- A connected mailbox can be the sender of
emails.sendwith an API key, of broadcasts, automations and sign-up forms, and a key or an app can send from the free address of the person it acts for. Only that person may send as a free address. threads.counts()leaves labelled mail out ofteam.assignedandteam.unassigned, as the inbox does, unless the person has chosen to show labelled mail in the inbox.domains,members,keys,webhooksandrulestakeq=onlist,list_allanditerate, and so doesconnected_mailboxes.list. It searches every field a person reads on the row: names, addresses, ids, scopes, events, condition values. Every word has to appear, ignoring case and accents, and close spellings count when nothing matches exactly.rules.stats()reads how the rules did inside a window: messages matched and failed, a series of buckets, the matches of each rule, the actions taken, the failures and the senders matched most.rule_ids=counts some rules only, and the result is typed asRuleStatsResourceinnextmail.types.billing.get()reportsusage.addressChecks: the deep address checks used this calendar month, what the plan includes and when they start again, besidepayAsYouGo.coversAddressChecksandextraAddressChecks.billing.list_plans()gives each plan’smonthlyAddressChecks, andbilling.get_pay_as_you_go()addsprices.addressChecksandperiod.addressChecks, all typed innextmail.types.tools.check_addressandtools.check_addresseswithdeep=Truefirst use the deep checks the plan includes each month (10 on Free, 100 on Starter, 500 on Business, 1,000 on Enterprise), then pay as you go at $1.50 per 100 addresses.- An automation branch can check the contact’s address:
{'kind': 'address_check', 'mailbox': ..., 'accept': ...}, withacceptfromnextmail.AUTOMATION_ADDRESS_ACCEPTSand the condition typed asAutomationAddressConditioninnextmail.types. - A send leaves out an address whose domain takes no mail, and one the check on sending finds has no mailbox. Each shows as
suppressed, with anemail.suppressedwebhook that names the reason, never as a bounce. - Forms check the address of every sign-up:
forms.subscriberefuses one whose domain takes no mail with the field errorundeliverable.settings['refuseDisposable']also refuses throwaway addresses (disposable),settings['checkMailbox']runs a deep check on every sign-up and refuses a missing mailbox (mailbox_not_found), and a refused address that looks like a typo carriessuggestion.