Get Emails
AI-generatedOverview
This node connects to an IMAP email server to retrieve and filter emails from a specified mailbox. It supports filtering by read status, date range, sender, recipient, subject, and attachment presence. Users can limit the number of emails returned and choose whether to include email body content and attachments. This node is useful for automating email processing workflows, such as monitoring an inbox for new messages, extracting email data for further processing, or archiving emails based on specific criteria.
Use Case Examples
- Retrieve the latest 50 unread emails from the INBOX.
- Get all emails from a specific sender within a date range.
- Fetch emails that contain attachments and include the attachment data for processing.
Properties
| Name | Meaning |
|---|---|
| Mailbox | The mailbox folder to search in, e.g., INBOX or Sent. |
| Limit | Maximum number of email results to return. |
| Read Status | Filter emails by their read status: all, unread only, or read only. |
| Additional Options | Additional filters and options for retrieving emails. |
Output
JSON
uid- Unique identifier of the email.messageId- Message ID of the email.subject- Subject line of the email.from- Sender information as text.to- Recipient information as text.cc- CC recipients as text.bcc- BCC recipients as text.date- Date the email was sent.flags- IMAP flags associated with the email.isRead- Boolean indicating if the email is read.hasAttachments- Boolean indicating if the email has attachments.attachmentCount- Number of attachments.bodyText- Plain text body of the email (if included).bodyHtml- HTML body of the email (if included).attachments- Array of attachment metadata if attachments are included.
Dependencies
- An IMAP server connection with credentials including email, password, host, port, and TLS settings.
Troubleshooting
- Connection errors due to incorrect IMAP credentials or server settings. Verify credentials and server details.
- Empty results if mailbox is empty or filters exclude all emails. Adjust filters or mailbox selection.
- Errors parsing email content if emails are malformed. This is handled gracefully but may result in missing some emails.
- Attachment inclusion requires sufficient memory and processing time; large attachments may impact performance.
Links
- Node.js IMAP Module - Used for connecting and interacting with the IMAP server.
- Mailparser Library - Used to parse raw email content into structured data.