IMAP guide
Learn how to implement a custom IMAP authentication flow inside your application using the postpress API.
Step 1: Authenticate to IMAP
POST the user's IMAP and SMTP server details to the accounts endpoint, or call the matching SDK method. postpress validates the credentials against the configured hosts and returns the connected account on success.
curl --request POST \
--url https://api.postpress.ai/v1/accounts \
--header 'X-API-KEY: ${POSTPRESS_API_KEY}' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '{
"provider": "MAIL",
"imap_user": "yourmail@example.com",
"smtp_user": "yourmail@example.com",
"imap_password": "***",
"smtp_password": "***",
"imap_host": "imap.example.com",
"smtp_host": "smtp.example.com",
"imap_port": 993,
"smtp_port": 465,
"imap_encryption": "SSL"
}'Required fields
provider: alwaysMAILfor IMAP accounts.imap_userandsmtp_user: the mailbox username on each server.imap_passwordandsmtp_password: the mailbox password or app password on each server.imap_hostandsmtp_host: the hostnames of the IMAP and SMTP servers.imap_portandsmtp_port: the ports for each server (commonly993for IMAP over SSL and465for SMTP over SSL).imap_encryption: the encryption mode. UseSSLfor implicit TLS on port 993, or the value that matches the provider's configuration.
Updated May 2026