Skip to main content

Get Email

Command description

Retrieve messages through IMAP. The command supports QQ Mail, 163 Mail, and 126 Mail, as well as custom IMAP settings for other providers.

The authorization code is not the mailbox login password. Obtain it after enabling IMAP/SMTP in the mailbox settings.

By default, the most recent emails are retrieved from the inbox INBOX. You can choose to retrieve only unread emails, mark them as read after retrieval, save attachments, or filter by sender, recipient, subject, and text contained in the body.

Command Input Parameters

input parametersInput parameter typeDescription
Mailbox TypeenumQQ Mail, 163 Mail, 126 Mail, Other Email Provider
IMAP ServerstrRequired when the mailbox type is Other Email Provider, such as imap.example.com
IMAP Portint or strRequired when the mailbox type is Other Email Provider, default 993
Email AccountstrMailbox account used to sign in
Authorization CodestrEmail authorization code
Email Countint or strMaximum number of emails retrieved, starting from the latest email
Unread Emails OnlyboolTrue to get only unread emails
Save AttachmentsboolSave email attachments when True
Attachment Save DirectorystrRequired when saving attachments is True
Folder Selection MethodenumDefault, Dynamic
Folder NamestrRequired when Folder Selection Method is Dynamic; the inbox is usually INBOX
Mark as ReadboolIf True, mark each retrieved email as read
Sender ContainsstrOptional, no filtering if empty
Recipient ContainsstrOptional, no filtering if empty
Subject ContainsstrOptional, no filtering if empty
Body ContainsstrOptional, no filtering if empty

Command Output Parameters

Output parametersOutput parameter typeDescription
Email Listlist[dict]Each email is a mapping, including subject, sender, receiver, cc, date, text, html, attachments, message_id

Generation Notes

  • Use the IMAP authorization code, not the web login password. Only Other Email Provider requires IMAP Server and IMAP Port.
  • When Save Attachments is True, Attachment Save Directory is required.