Maildrop
Search…
⌃K
Links
📬

Get a Mailbox Listing

This is the GraphQL query to run in order to get a list of all messages inside a mailbox.
Please note that the list of messages in the mailbox will come back with the "data" and "html" fields set to null. This is for performance reasons - returning 10 messages with 500k of data each would wind up with extremely slow mailbox listings. If you want to retrieve the data and html of a message, get the message id, and then retrieve the specific message.
​
post
https://api.maildrop.cc/graphql
Gets an array of messages belonging to a mailbox.
This GraphQL query takes a mailbox and an id as required parameters. Returns an array of Message objects with the "data" and "html" fields set to null.
(GraphQL best practices discourage queries and variable names from being the same, so the query is named "inbox".)
Parameters
Header
Content-Type
String
application/json
Body
String
'{"query":"query Example { inbox(mailbox:\"testing\") { id headerfrom subject date } }"}'
Responses
200: OK

See Also

​
​
curl
React
curl --request POST \
--header 'content-type: application/json' \
--url https://api.maildrop.cc/graphql \
--data '{"query":"query Example { inbox(mailbox:\"testing\") { id headerfrom subject date } }"}'
returns:
{"data":{"inbox":[{"id":"AIm59ihdGy","headerfrom":"[email protected]","subject":"test Thu, 09 Feb 2023 23:51:14 +0000","date":"2023-02-09T23:51:14.411Z"}]}}
export const GET_INBOX = gql`
query GetInbox($mailbox: String!) {
inbox(mailbox: $mailbox) {
id
subject
date
headerfrom
}
}
`;
​
interface QueryReturn {
inbox: Message[];
}
​
interface MyComponentProps {
mailbox: string;
}
​
const MyComponent = (props: MyComponentProps) => {
const { loading, error, data } = useQuery<QueryReturn>(GET_INBOX, {
variables: { mailbox: props.mailbox }
});
return (
<div>
{loading && <div>Loading...</div>}
{!loading && error && <div>There was an error.</div>}
{data?.inbox.map((message: Message) => (<div key={message.id}>{message.subject}</div>))}
</div>
);
};
​
​