Retrieve the SMTP Custom Emails of an organization with cursor-based pagination.
Before You Begin
🔗 Use the GraphQL Playground to execute the queries in this guide.
➡️ New to GraphQL? Learn how to navigate the Playground with our Playground Basics Guide.
Why this use case
Use this query when an organization has many custom senders and you need to page through them with GraphQL cursor-based pagination. For a simple flat list (limited to 30 entries, default sender first), use List SMTP Custom Emails instead.
Prerequisites
- Authentication: Use a Service Account token (Personal Access Tokens are deprecated).
- Permissions: Your token must be able to read SMTP custom emails in the target organization.
- IDs: See our Get resource IDs page for how to find the
organizationId.
Step 1: Run the query
query OrganizationSmtpCustomEmails($organizationId: ID!, $first: Int, $after: String) {
organizationSmtpCustomEmails(organizationId: $organizationId, first: $first, after: $after) {
edges {
node {
id
emailAddress
senderName
}
}
pageInfo {
endCursor
hasNextPage
}
}
}
Variables
{
"organizationId": "12345",
"first": 20
}
Step 2: Check the response
{
"data": {
"organizationSmtpCustomEmails": {
"edges": [
{
"node": {
"id": 678,
"emailAddress": "[email protected]",
"senderName": "Your Company"
}
}
],
"pageInfo": {
"endCursor": "MQ",
"hasNextPage": true
}
}
}
}
Returned fields
| Field | Description |
|---|---|
edges[].node.id | The SMTP Custom Email ID — use it in Update, Delete, and Set the Default Organization SMTP Custom Email |
edges[].node.emailAddress | The sender email address used for outbound messages |
edges[].node.senderName | The display name shown to recipients |
pageInfo.endCursor | Cursor of the last returned email — pass it as after to fetch the next page |
pageInfo.hasNextPage | Whether more emails exist beyond this page |
Step 3: Fetch the next page
Pass the previous endCursor as after to continue paging:
{
"organizationId": "12345",
"first": 20,
"after": "MQ"
}
Implementation notes
- Results are ordered by sender name (ascending).
- The query returns an empty connection when the token cannot read SMTP custom emails in the organization.
