nextmail.senders
Every method in this namespace: its signature, its parameters, what it returns and an example.
Methods
What is known about the organisation behind a sender, the line the reading pane shows under an unfamiliar one, and looking a sender up.
senders.get()
Read what is known about a sender
def get( email: str, *, api_key: str | None = None, timeout: float | None = None,) -> SenderProfileResourceReturns a sentence or two about the organisation behind the domain of an address, the line the reading pane shows under an unfamiliar sender. Only the domain is read, so any address on it gives the same answer, a subdomain such as mail.stripe.com included, and domain names the organisation's own domain. What is known is shared by every workspace and looked up again by itself once it is 30 days old.
A domain nobody has looked up yet is a 404, and so are personal mailbox providers such as Gmail and the domains of your own workspace. Each raises NextmailApiError with is_not_found. research looks a domain up.
Parameters
emailstrRequiredAn address of the sender, such as
[email protected].api_keystrOverrides the client's API key for this call only.
timeoutfloatSeconds this call may take, the response included, before it raises
NextmailNetworkErrorwithis_timeout. It overrides the client'stimeoutfor this call, and0turns the limit off.
Returns
SenderProfileResource, a dict with object set to 'sender_profile', domain, about and updatedAt.
Example
from nextmail import NextmailApiError, nextmail try: sender = nextmail.senders.get('[email protected]') print(sender['domain'], sender['about'])except NextmailApiError as error: if error.is_not_found: print('Nobody has looked stripe.com up yet') else: raiseNotes
An address with no domain is a 422
invalid_parameteronemail.
Also available in
senders.research()
Look a sender up
def research( email: str, *, api_key: str | None = None, timeout: float | None = None,) -> SenderProfileResourceSearches the web for the organisation behind the domain of an address and keeps what it found, as the reading pane does the first time it shows a sender. Every address under the domain shares the answer, a subdomain such as mail.stripe.com included, and it is kept for 30 days before it is looked up again, so a domain that was looked up before is answered from what was kept and nothing is searched. Personal mailbox providers such as Gmail and the domains of your own workspace are never looked up.
Only the owner of the workspace may look senders up, with a key or an app that is not limited to particular addresses or domains: anything else is a 422 capability_unsupported or a 403 owner_only. A workspace looks up at most 200 new domains a day, and the next one is a 429 research_limit_reached. A domain nothing could be found about, a personal mailbox provider and a domain of your own workspace are a 404.
Parameters
emailstrRequiredAn address of the sender. Only its domain is looked up.
api_keystrOverrides the client's API key for this call only.
timeoutfloatSeconds this call may take, the response included, before it raises
NextmailNetworkErrorwithis_timeout. It overrides the client'stimeoutfor this call, and0turns the limit off.
Returns
SenderProfileResource, what was found or what was already known.
Example
from nextmail import nextmail sender = nextmail.senders.research('[email protected]') print(sender['domain'], sender['about'])Notes
The SDK retries it after a network failure, which is safe because a domain that was found is answered from what was kept.