Articles in this section
Category / Section

IMAP Email Parser

4 mins read
Updated:

Monitor email accounts and automatically trigger workflows when new emails arrive. Connect Gmail, Outlook, Yahoo, or any IMAP-compatible email service to FlowMattic and automate your email processing. Perfect for creating support tickets, processing invoices, capturing leads, and managing attachments without manual intervention.


Quick Setup

Connect Your Email Account

  1. Go to FlowMattic Settings → IMAP Email Accounts
  2. Click Add New Account
  3. Enter your email details:
    • Account Label: Friendly name (e.g., “Support Email”)
    • Host: Mail server address (e.g., imap.gmail.com)
    • Port: 993 for SSL or 143 for TLS
    • Username: Your email address
    • Password: Your email password (use App Password for Gmail/Outlook)
    • Encryption: SSL (recommended)
  4. Click Test Connection
  5. Click Add Account

IMAP Settings ‹ FlowMattic

Create Workflow

  1. Create new workflow
  2. Select IMAP Email Parser as trigger
  3. Choose your email account
  4. Select folder to monitor (default: INBOX)
  5. Choose trigger type
  6. Set check frequency (recommended: 5-10 minutes)
  7. Click Save & Capture Email

IMAP Email Parser - Workflow example.png


Trigger Types

Email Received: Triggers on every new email
Email with Subject Contains: Triggers when subject has specific text
Email from Specific Sender: Triggers for emails from certain addresses
Email with Attachment: Triggers only when emails have attachments


Available Actions

Import Attachments

Downloads email attachments and saves them to WordPress media library automatically.

Use Cases:

  • Save invoice PDFs from vendor emails
  • Store customer documents from support tickets
  • Archive contract attachments from legal correspondence
  • Capture lead magnets sent via email
  • Backup important files received in emails

Required Fields:

  • Email folder: Use folder from trigger
  • Message UID: Use uid from trigger

Returns for Each Attachment:

  • media_1_id - WordPress media library ID
  • media_1_url - Direct file URL
  • media_1_name - Original file name
  • media_1_type - MIME type (e.g., application/pdf)

Additional attachments return media_2_id, media_3_id, etc. Use these IDs in subsequent workflow steps to update posts, send notifications, or process files further.


Available Data

Use these fields in your workflow:

  • subject - Email subject
  • from_email - Sender email
  • from_name - Sender name
  • to - Recipient
  • body_text - Plain text
  • body_html - HTML version
  • date - Date sent
  • uid - Unique ID
  • has_attachments - true/false
  • attachment_count - Number of attachments

Email Provider Settings

Gmail

  • Host: imap.gmail.com
  • Port: 993
  • Encryption: SSL
  • Note: Must use App Password

Outlook

  • Host: outlook.office365.com
  • Port: 993
  • Encryption: SSL
  • Note: Must use App Password

Yahoo

  • Host: imap.mail.yahoo.com
  • Port: 993
  • Encryption: SSL

Gmail Setup

  1. Enable IMAP: Gmail Settings → Forwarding and POP/IMAP
  2. Create App Password:
    • Google Account → Security → 2-Step Verification → App Passwords
    • Select “Mail” and your device
    • Copy generated password
  3. Use App Password in FlowMattic (not regular password)

Outlook Setup

  1. Enable IMAP: Outlook Settings → Mail → Sync email
  2. Create App Password:
    • Microsoft Account → Security → App Passwords
    • Generate new password
  3. Use App Password in FlowMattic

Examples

Support Tickets: Email received → Create ticket → Send confirmation

Invoice Processing: Email with invoice → Import attachment → Create record

Lead Capture: Contact form email → Extract data → Add to CRM


Troubleshooting

Connection Failed

  • Verify host and port
  • Use App Password for Gmail/Outlook
  • Check if hosting blocks IMAP
  • Try disabling “Validate Certificate”

No Emails Found

  • Ensure emails are unread
  • Check emails are within 24 hours
  • Verify filters aren’t too restrictive

Processing Twice

  • Enable “Mark as Read”
  • Check for duplicate workflows

Can’t Import Attachments

  • Use uid from trigger
  • Check WordPress upload permissions
  • Verify file types are supported

IMAP Extension Error

  • Contact hosting provider to enable PHP IMAP extension

Settings

Polling Frequency: How often to check (5-10 minutes recommended)

Mark as Read: Marks processed emails as read

Email Folder: Which folder to monitor


How It Works

  1. Checks email at set intervals
  2. Remembers last processed email
  3. Only processes new emails
  4. Processes oldest first
  5. Never deletes emails

Security

  • Use App Passwords
  • Enable SSL/TLS
  • Use dedicated email accounts
  • Review accounts regularly

FAQ

How often should I check for emails?
We recommend checking every 5-10 minutes to balance server load and timely processing. More frequent checks may impact your email provider’s rate limits. You can adjust the schedule based on your needs - urgent emails can use 5-minute intervals, while non-critical monitoring can use 15-30 minutes.

Can I monitor multiple email accounts?
Yes, you can add unlimited email accounts. Each account is stored separately with its own credentials. Create separate workflows for each account based on your trigger event requirements - for example, one workflow for support emails and another for sales notifications.

Does FlowMattic delete emails from my server?
No, all emails remain on your mail server. FlowMattic only reads emails without modifying them. You have the option to mark emails as read if needed to avoid duplicate processing, but this is optional. Your original emails stay intact and accessible through your regular email client.

Can I monitor multiple folders in the same account?
Yes, but you’ll need one workflow per folder. Each workflow can monitor a different folder (INBOX, Sent, Custom folders, etc.). This gives you flexibility to process different folders with different actions - for example, monitoring INBOX for support tickets and a “Orders” folder for purchase notifications.

Is my email password secure?
Yes, all credentials are encrypted and stored securely in your WordPress database. Passwords are never exposed in workflow data or logs. We recommend using App Passwords (for Gmail/Outlook) instead of your main account password for additional security.

How do I use this with 2FA-enabled accounts?
For accounts with two-factor authentication (Gmail, Outlook, Yahoo), you must generate an App Password. Regular passwords won’t work with IMAP when 2FA is enabled. See the Gmail/Outlook/Yahoo setup guides above for step-by-step App Password generation instructions.

Was this article useful?
Like
Dislike
Help us improve this page
Please provide feedback or comments
Access denied
Access denied