Test email receiving
Tests the account’s IMAP configuration by connecting to the email server and retrieving the latest email from the inbox.
Purpose:
- Validates IMAP server connection and authentication
- Tests email retrieval functionality
- Helps troubleshoot email receiving issues
- Verifies that the account can access the mailbox
Process:
- Connects to the account’s IMAP server using configured credentials
- Retrieves the most recent email from the inbox
- Returns email metadata (message ID, subject, sender, date)
- Returns success or failure with error details
Supported Account Types:
- Works best with IMAP accounts (full IMAP configuration)
- OAuth accounts (Google, Office365) may have limitations depending on token status
Response:
- Success: Returns details of the latest email (message ID, subject, sender, date)
- Failure: Returns error message describing what went wrong (connection issues, authentication failures, no emails found, etc.)
POST
/administration/email-accounts/{id}/test-receivingAuthorization
AuthorizationOAuth2 access token · headerrequiredScopes:
api:writeor
AuthorizationBearer token (JWT) · headerrequiredPath parameters
idstringrequiredQuery parameters
fieldsToReturnstringComma-separated list of top-level response fields to return. Overrides the endpoint compact default unless responseShape=full is used.
responseShapestringAdvanced override. Omit for the endpoint compact default. Use full only when you need the complete endpoint response, including nested fields that are not selectable with fieldsToReturn.
Allowed:
compactfullHeader parameters
LT-Response-ShapestringAdvanced override. Set to full only when you need the complete endpoint response, including nested fields that are not selectable with fieldsToReturn.
Allowed:
fullResponses
200Successfully connected and retrieved email
datestring<date-time>ISO 8601 timestamp indicating when the most recent email was received.
fromobjectSender email address(es) of the most recent email. Multiple addresses are comma-separated if present.
messagestringrequiredHuman-readable message describing the test result. Includes success confirmation or error details explaining what went wrong.
messageIdstringMessage ID of the most recent email retrieved from the inbox. This is a unique identifier assigned by the email server.
subjectstringSubject line of the most recent email retrieved from the inbox.
successbooleanrequiredIndicates whether the test was successful. `true` means the connection was established and an email was retrieved, `false` means there was an error.
400Failed to connect or retrieve email
401Unauthorized - Invalid or missing authentication token
403Forbidden - Insufficient API scopes or permissions
404Email account not found
Request
curl -X POST "https://leadtime.app/api/public/administration/email-accounts/string/test-receiving" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN"const response = await fetch("https://leadtime.app/api/public/administration/email-accounts/string/test-receiving", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_ACCESS_TOKEN"
}
});import requests
response = requests.post(
"https://leadtime.app/api/public/administration/email-accounts/string/test-receiving",
headers={
"Authorization": "Bearer YOUR_ACCESS_TOKEN"
},
)Response
{
"date": "2024-01-20T10:30:00Z",
"from": "sender@example.com",
"message": "Successfully connected and retrieved latest email",
"messageId": "<abc123@example.com>",
"subject": "Test Email Subject",
"success": true
}Failed to connect or retrieve email
Unauthorized - Invalid or missing authentication token
Forbidden - Insufficient API scopes or permissions
Email account not found