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: always MAIL for IMAP accounts.
  • imap_user and smtp_user: the mailbox username on each server.
  • imap_password and smtp_password: the mailbox password or app password on each server.
  • imap_host and smtp_host: the hostnames of the IMAP and SMTP servers.
  • imap_port and smtp_port: the ports for each server (commonly 993 for IMAP over SSL and 465 for SMTP over SSL).
  • imap_encryption: the encryption mode. Use SSL for implicit TLS on port 993, or the value that matches the provider's configuration.
Updated May 2026