aws-workmail-ews

n8n node for AWS WorkMail using Exchange Web Services (EWS) protocol

Documentation

n8n-nodes-aws-workmail-ews

This is an n8n community node that allows you to interact with AWS WorkMail using the Exchange Web Services (EWS) protocol.

AWS WorkMail is compatible with Microsoft Exchange, which means it supports EWS for programmatic access. This node provides comprehensive integration with AWS WorkMail, including email management, calendar operations, contacts, folders, and attachments.

n8n is a fair-code licensed workflow automation platform.

Installation

Follow the installation guide in the n8n community nodes documentation.

Manual Installation

  1. Navigate to your n8n installation directory
  2. Install the package:
npm install n8n-nodes-aws-workmail-ews
  1. Restart n8n

Using npm

npm install n8n-nodes-aws-workmail-ews

Configuration

Prerequisites

You need the following information from your AWS WorkMail setup:

  1. EWS Endpoint URL: Your AWS WorkMail EWS endpoint (e.g., https://ews.mail.eu-west-1.awsapps.com/EWS/Exchange.asmx)
  2. Email Address: Your AWS WorkMail email address
  3. Password: Your AWS WorkMail password

Finding Your EWS Endpoint

The EWS endpoint URL follows this pattern:

https://ews.mail.[region].awsapps.com/EWS/Exchange.asmx

Common regions:

  • us-east-1 (US East - N. Virginia)
  • us-west-2 (US West - Oregon)
  • eu-west-1 (Europe - Ireland)
  • ap-southeast-2 (Asia Pacific - Sydney)

Setting Up Credentials in n8n

  1. Go to Credentials in n8n
  2. Click Create New Credential
  3. Search for "AWS WorkMail EWS API"
  4. Enter your credentials:
    • EWS Endpoint URL: Your full EWS endpoint URL
    • Email Address: Your AWS WorkMail email
    • Password: Your AWS WorkMail password
  5. Click Save

Operations

This node supports the following resources and operations:

Message (Email)

  • Send: Send a new email message
  • Send and Wait for Response: Send email and wait for reply (coming soon)
  • Reply: Reply to an existing message
  • Move: Move a message to a different folder
  • Delete: Delete a message
  • Get: Retrieve a single message by ID
  • Get Many: Retrieve multiple messages from a folder
  • Update: Update message properties (e.g., mark as read)

Folder

  • Create: Create a new mail folder
  • Delete: Delete a folder
  • Get: Get folder information
  • Get Many: List all folders
  • Get Many Folder Messages: Get all messages from a specific folder
  • Update: Update folder properties

Calendar

  • Create: Create a new calendar
  • Delete: Delete a calendar
  • Get: Get calendar information
  • Get Many: List all calendars
  • Update: Update calendar properties

Event (Calendar Items)

  • Create: Create a new calendar event/appointment
  • Delete: Delete an event
  • Get: Get event details
  • Get Many: List events from a calendar
  • Update: Update event properties

Contact

  • Create: Create a new contact
  • Delete: Delete a contact
  • Get: Get contact information
  • Get Many: List all contacts
  • Update: Update contact properties

Attachment

  • Add: Add an attachment to a message
  • Download: Download an attachment as binary data
  • Get: Get attachment metadata
  • Get Many: List all attachments of a message

Trigger

  • On Message Received: Trigger workflow when new emails are received (polling)

Usage Examples

Example 1: Send an Email

  1. Add the AWS WorkMail (EWS) node to your workflow
  2. Select Message as the resource
  3. Select Send as the operation
  4. Configure:
    • To Recipients: recipient@example.com
    • Subject: Hello from n8n
    • Body: This is a test email sent via n8n and AWS WorkMail
    • Body Type: HTML or Text

Example 2: Poll for New Emails

  1. Add the AWS WorkMail Trigger (EWS) node to start your workflow
  2. Configure:
    • Folder: inbox (or specific folder ID)
    • Max Items: 10 (number of messages to fetch per poll)
    • Download Attachments: Enable if you want to download attachments

Example 3: Create Calendar Event

  1. Add the AWS WorkMail (EWS) node
  2. Select Event as the resource
  3. Select Create as the operation
  4. Configure:
    • Calendar ID: calendar (default calendar)
    • Subject: Team Meeting
    • Start Time: 2024-02-15T10:00:00Z
    • End Time: 2024-02-15T11:00:00Z
    • Location: Conference Room A
    • Required Attendees: user1@example.com, user2@example.com

Example 4: Download Email Attachments

  1. Add the AWS WorkMail (EWS) node
  2. Select Attachment as the resource
  3. Select Download as the operation
  4. Configure:
    • Attachment ID: Use from previous message retrieval
    • Binary Property: data (name for binary data storage)

Example 5: Move Message to Folder

  1. Add the AWS WorkMail (EWS) node
  2. Select Message as the resource
  3. Select Move as the operation
  4. Configure:
    • Message ID: ID of the message to move
    • Target Folder ID: ID of the destination folder

Example 6: Create Reply Draft with AI Agent

This example shows how to use an AI agent to prepare email replies that can be reviewed before sending.

  1. Add the AWS WorkMail Trigger (EWS) to start workflow on new emails
  2. Add an AI Agent node to generate a reply
  3. Add the AWS WorkMail (EWS) node:
    • Select Message as the resource
    • Select Create Reply Draft as the operation
    • Configure:
      • Message ID: {{ $('Trigger').item.json.ItemId.Id }}
      • Reply Body: {{ $('AI Agent').item.json.response }}
      • Body Type: HTML or Text
      • Reply All: Enable if needed

The draft will be saved in your Drafts folder where you can review and edit it before sending manually.

Distinguished Folder IDs

AWS WorkMail EWS supports these standard folder identifiers:

  • inbox - Inbox folder
  • sentitems - Sent Items folder
  • deleteditems - Deleted Items folder
  • drafts - Drafts folder
  • junkemail - Junk Email folder
  • msgfolderroot - Root of the mailbox folder hierarchy
  • calendar - Default calendar folder
  • contacts - Default contacts folder

Timezone Handling

When working with calendar events, dates and times should be provided in ISO 8601 format:

2024-02-15T10:00:00Z (UTC)
2024-02-15T10:00:00+01:00 (with timezone offset)

Error Handling

The node implements comprehensive error handling:

  • 401 Unauthorized: Check your credentials (email/password)
  • 404 Not Found: Invalid message/folder/item ID
  • 500 Server Error: AWS WorkMail service issue

Enable "Continue On Fail" in the node settings to handle errors gracefully in your workflow.

Limitations

  • Maximum 500 items can be retrieved per request (EWS limitation)
  • Polling trigger checks for new messages based on timestamp (may miss messages in rare clock skew scenarios)
  • Large attachments may impact performance
  • Cannot reply to own messages: Exchange/MAPI does not allow replying to messages sent by the same account (error code 0x80040607)

Testing

This node has been extensively tested with real AWS WorkMail:

  • 100% Success Rate: All 26 operations tested and working (26/26)
  • Real Environment: Tested with AWS WorkMail EU-WEST-1
  • All Resources: Messages, Folders, Events, Contacts, Attachments
  • All Operations: Create, Read, Update, Delete (CRUD) for each resource

Test Results

Messages:    7/7  operations ✅
Folders:     5/5  operations ✅
Events:      5/5  operations ✅
Contacts:    5/5  operations ✅
Attachments: 4/4  operations ✅
───────────────────────────────
Total:      26/26 operations ✅
Success Rate: 100%

Compatibility

  • n8n version: 1.0.0 or higher
  • AWS WorkMail: All regions
  • EWS Protocol: Exchange 2010 SP2 (AWS WorkMail uses this version)

Resources

Development

Building

npm install
npm run build

Testing

Interactive Test Suite

An interactive test suite is included for testing all operations:

  1. Copy .env.example to .env:

    cp .env.example .env
    
  2. Edit .env and fill in your AWS WorkMail credentials:

    EWS_USERNAME=your-email@example.com
    EWS_PASSWORD=your-password
    EWS_URL=https://ews.mail.{region}.awsapps.com/EWS/Exchange.asmx
    
  3. Run the interactive test suite:

    node test.js
    

The test suite provides an interactive menu to:

  • Test individual operations (Get Messages, Send Message, etc.)
  • Run all tests at once
  • Verify connection and credentials

Local n8n Testing

Link the package locally for testing in n8n:

npm link
cd ~/.n8n/nodes
npm link n8n-nodes-aws-workmail-ews

License

MIT

Support

For issues, questions, or contributions, please visit the GitHub repository.

Discussion