Get Mail
Retrieves emails from a specified Microsoft Outlook folder. This node allows you to fetch messages from any Outlook folder such as Inbox, Sent Items, or custom folders, with options to filter by read status and automatically mark messages as read.
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
If the ContinueOnError property is set to true, no error will be caught and the automation will continue running. If a Catch node is used, it will have no effect.
Inputs
- Account Mail Address - The email account address to retrieve emails from (e.g.,
user@company.com). This must match an account configured in Outlook. - Mail Folder - The folder name to retrieve emails from. Default is
INBOX. Common values include:INBOX- Main inbox folderSent Items- Sent messagesDrafts- Draft messagesDeleted Items- Trash folder- Custom folder names you've created
- Number of Messages - Maximum number of emails to retrieve. Must be greater than zero. Default is
10.
Outputs
- Result - A list of Mail objects, each containing:
from- Sender's email addressto- Array of recipient email addressescc- Array of CC recipient email addressessubject- Email subject linebody- Email body content (plain text)datetime- Date and time the email was receivedentryId- Unique identifier for the email (used with Move Mail and Save Attachments nodes)storeId- Store identifier for the email account
Options
- Only Unread Mails - If set to
true, only unread emails will be retrieved. Default isfalse. - Mark as Read - If set to
true, retrieved emails will be marked as read. Default isfalse.
Example Usage
Basic Email Retrieval
Retrieve the 10 most recent emails from Inbox:
// Get Mail node outputs
const emails = $.Result;
// Process each email
for (const email of emails) {
console.log(`From: ${email.from}`);
console.log(`Subject: ${email.subject}`);
console.log(`Date: ${email.datetime}`);
console.log(`---`);
}
Retrieve Unread Emails and Mark as Read
Set the node options:
- Only Unread Mails:
true - Mark as Read:
true
// Get only unread emails and mark them as read
const unreadEmails = $.Result;
console.log(`Retrieved ${unreadEmails.length} unread emails`);
Check for Emails from Specific Sender
const emails = $.Result;
// Filter emails from a specific sender
const importantEmails = emails.filter(email =>
email.from.includes('manager@company.com')
);
if (importantEmails.length > 0) {
console.log(`Found ${importantEmails.length} emails from manager`);
// Process important emails...
}
Extract Email IDs for Further Processing
const emails = $.Result;
// Store entry IDs for later use (e.g., moving or saving attachments)
const emailIds = emails.map(email => ({
entryId: email.entryId,
storeId: email.storeId,
subject: email.subject
}));
// Pass to next node for attachment processing
return emailIds;
Tips for Effective Use
-
Start Small: When testing, use a small number (e.g., 5-10) for Number of Messages to avoid processing too many emails at once.
-
Folder Names: Ensure folder names match exactly as they appear in Outlook, including spaces and capitalization.
-
Entry ID and Store ID: Always save these values from the Result if you plan to use Move Mail or Save Attachments nodes later in your flow.
-
Unread Filtering: Use the "Only Unread Mails" option to process only new emails, which is useful for monitoring scenarios.
-
Mark as Read: Enable this option when you want to prevent processing the same emails multiple times in scheduled automations.
-
Email Sorting: Emails are automatically sorted by received time in descending order (most recent first).
Common Errors and Solutions
Error: Account Mail Address cannot be empty
- Solution: Provide a valid email address that is configured in Microsoft Outlook on the machine.
Error: Mail Folder cannot be empty
- Solution: Specify a valid folder name. Use
INBOXfor the main inbox or the exact name of any custom folder.
Error: Number of Messages must be greater than zero
- Solution: Set the Number of Messages input to a positive integer value.
Error: Cannot access the specified folder
- Solution: Verify that:
- The folder name is spelled correctly
- The folder exists in the specified email account
- Microsoft Outlook is properly configured and accessible
No emails returned despite having emails in the folder
- Solution: Check if:
- The "Only Unread Mails" option is enabled but all emails are already read
- The Number of Messages is sufficient
- The correct Account Mail Address is specified