Email Trigger¶
Overview¶
The Email Trigger (Inbound Email Trigger) automatically starts workflows when emails are received at specific email addresses. This enables powerful email-based automation like parsing customer inquiries, processing support tickets, handling order confirmations, and more.
When to use this trigger:
- Process support emails automatically
- Parse order confirmations from suppliers
- Handle lead inquiries from email
- Process email-to-ticket conversions
- Monitor specific email addresses for actions
- Parse and extract data from structured emails
Quick Start¶
Builder fields¶
The Field column is the label as it appears in the task builder; Key is the name the value is stored under and referenced by.
| Field | Key | Type | Default | Notes |
|---|---|---|---|---|
| Inbound Email Address | token |
email-display | – |
- Connect your email account (Gmail, Microsoft 365, or IMAP)
- Create a new workflow
- Add an Email Trigger as the first task
- Configure email matching rules (from, subject, etc.)
- Save and enable the workflow
- When matching emails arrive, the workflow runs automatically
Connecting Email Accounts¶
Gmail Integration¶
- Click "Connect Gmail Account" in the Email Trigger settings
- Authorize BaseCloud to access your Gmail
- Select which Gmail account to monitor
- Configure matching rules
Permissions Required:
- Read emails (readonly access)
- BaseCloud cannot send emails or modify your mailbox
Microsoft 365 / Outlook Integration¶
- Click "Connect Microsoft Account"
- Sign in with your Microsoft credentials
- Authorize BaseCloud
- Select the mailbox to monitor
- Configure matching rules
Supported Accounts:
- Outlook.com personal accounts
- Microsoft 365 business accounts
- Exchange Online mailboxes
IMAP Integration (Any Email Provider)¶
For email providers not directly supported, use IMAP:
- Select "Connect via IMAP"
- Enter your IMAP server settings:
- Host: e.g.,
imap.gmail.com - Port: Usually 993 (SSL) or 143 (non-SSL)
- Username: Your email address
- Password: Your email password or app-specific password
- Use SSL: Recommended (checked)
Common IMAP Settings:
| Provider | IMAP Host | Port | SSL |
|---|---|---|---|
| Gmail | imap.gmail.com | 993 | Yes |
| Outlook | outlook.office365.com | 993 | Yes |
| Yahoo | imap.mail.yahoo.com | 993 | Yes |
| iCloud | imap.mail.me.com | 993 | Yes |
Email Matching Rules¶
Configure rules to determine which emails trigger your workflow.
Match by Sender (From Address)¶
Trigger only when emails come from specific addresses:
Or use wildcards:
Match by Subject¶
Trigger when subject contains specific text:
Or use partial matching:
Match by Recipient (To Address)¶
Trigger when email is sent to specific addresses:
Match by CC or BCC¶
Combine Multiple Rules¶
Use AND logic to match multiple criteria:
This triggers only when BOTH conditions are met.
Match All Emails¶
Leave rules empty to trigger on every email received at the connected account.
Warning: This can trigger many workflows. Use specific rules to avoid unnecessary executions.
Outputs¶
| Field | Type | Example | Notes |
|---|---|---|---|
from_email |
string | jane@example.com |
Sender address. |
from_name |
string | Jane Doe |
Sender display name. |
to_email |
string | sales@…, info@… |
Comma-separated list of recipients. |
subject |
string | Quote request |
|
body |
string | Hi, could you… |
The message with HTML tags stripped — the field to use for matching and AI prompts. |
body_html |
string | <p>Hi, could you…</p> |
The original HTML body. |
body_text |
string | Hi, could you… |
The plain-text part, when the sender supplied one. |
email_id |
number | 99213 |
The stored email's ID. |
date_received |
string | 2026-09-07T09:14:02Z |
When it arrived. |
attachment_count |
number | 2 |
How many attachments. 0 when none. |
attachment_names |
string | quote.pdf,logo.png |
Comma-separated. Empty when none. |
attachment_urls |
string | https://…,https://… |
Comma-separated, same order as the names. |
attachment_sizes |
string | 18422,3110 |
Comma-separated byte sizes. |
attachment_types |
string | application/pdf,image/png |
Comma-separated content types. |
run |
boolean | true |
|
run_text |
string | Inbound data received and processed successfully. |
Attachment fields are parallel comma-separated strings, not a list
attachment_names, _urls, _sizes and _types share an order. To act on each attachment,
split them with a Formatter and iterate with a
Loop.
There is no cc, bcc, message_id or in_reply_to field — the trigger does not carry them.
Real-World Examples¶
Turn an inbound email into a CRM note¶
Email Trigger
└─ Match to Client contact_email: {{task_54001_from_email}}
└─ Workflow Note log the subject and body against the client
Route support mail with AI¶
Email Trigger
└─ AI Prompt classify {{task_54001_body}} as Sales, Support or Billing
└─ Key Match each category to its address
└─ Email forward it on
Save an attachment against the sender¶
Email Trigger
└─ Match to Client contact_email: {{task_54001_from_email}}
└─ Files download {{task_54001_attachment_urls}}
attachment_count is 0 when there were none, so branch on it before trying to save anything.
Pull an order number out of the message¶
Handling Attachments¶
Checking for Attachments¶
Use an If task to check if attachments exist:
Downloading Attachments¶
Attachment URLs are temporary and accessible for 24 hours:
To permanently store attachments:
- Use Webhook Out to download the file
- Use File task to upload to your storage
Processing Multiple Attachments¶
Use a Loop task to process each attachment:
- Loop - Loop through
task_54123.JSON.attachments - Inside loop: Process each attachment
Common Attachment Types¶
- PDF: Use PDF task to extract text
- Images: Use AI Prompt with vision models
- CSV/Excel: Download and parse with Code task
- Documents: Use Speech to Text if scanned
Parsing Email Content¶
Extract Data from Structured Emails¶
Many automated emails follow predictable formats. Use Code task or AI Prompt to extract data.
Example: Parse order confirmation
const body = results['task_54123_body_text'];
// Extract order number
const orderMatch = body.match(/Order #(\d+)/);
const orderNumber = orderMatch ? orderMatch[1] : '';
// Extract amount
const amountMatch = body.match(/Total: \$(\d+\.\d{2})/);
const amount = amountMatch ? amountMatch[1] : '';
return {
order_number: orderNumber,
amount: amount,
};
Clean Email Replies¶
Email replies often include previous message history. To extract just the new content:
const body = results['task_54123_body_text'];
// Split at common reply markers
const cleanBody = body
.split(/On .* wrote:/)[0]
.split(/From:/)[0]
.split(/-----Original Message-----/)[0]
.trim();
return { clean_message: cleanBody };
Extract Email Addresses from Body¶
const body = results['task_54123_body_text'];
const emailRegex = /[\w.-]+@[\w.-]+\.\w+/g;
const emails = body.match(emailRegex) || [];
return { extracted_emails: emails };
Auto-Reply Handling¶
Prevent Reply Loops¶
If your workflow sends an email in response, be careful not to create loops:
- Check
in_reply_tofield - Add a unique identifier to your auto-reply subject
- Use If task to skip processing if subject contains that identifier
Example:
Setting Reply-To Headers¶
When sending email responses, use the original sender:
Best Practices¶
✅ Do's¶
- Use specific matching rules: Avoid triggering on every email unnecessarily
- Handle missing data gracefully: Use If tasks to check required fields exist
- Clean email content: Strip HTML and reply history before processing
- Add error notifications: Alert yourself if critical email workflows fail
- Test with sample emails: Send test emails to verify matching rules work
- Document your rules: Add workflow description explaining matching logic
- Monitor execution history: Regularly check that emails are being processed
❌ Don'ts¶
- Don't create reply loops: Always check for auto-reply markers
- Don't store attachments indefinitely: Download and process quickly
- Don't trigger on all emails: Use specific rules to avoid wasted executions
- Don't expose sensitive data: Be careful when forwarding or logging email content
- Don't ignore spam: Add validation to detect and skip spam emails
Troubleshooting¶
Emails Not Triggering Workflow¶
Possible Causes:
- Email account not connected properly
- Matching rules too restrictive
- Workflow is disabled
- Email going to spam/junk folder
Solutions:
- Verify email account connection is active
- Test with broader matching rules temporarily
- Check workflow toggle is ON
- Ensure emails are arriving in inbox (not spam)
- Check execution history for error messages
Wrong Emails Being Processed¶
Cause: Matching rules too broad
Solution: Add more specific matching criteria:
Attachments Not Available¶
Possible Causes:
- Attachment URLs expired (after 24 hours)
- Attachment too large
- Attachment type blocked
Solutions:
- Process attachments immediately when email arrives
- Check attachment size limits
- Verify attachment content type is supported
Cannot Connect Email Account¶
Gmail:
- Enable "Less secure app access" (or use App Passwords)
- Check 2-factor authentication settings
Microsoft:
- Verify mailbox permissions
- Check admin hasn't blocked OAuth apps
IMAP:
- Verify IMAP is enabled in your email settings
- Use app-specific password if 2FA is enabled
- Check firewall isn't blocking IMAP port (993)
Advanced Features¶
Email Thread Tracking¶
Track conversation threads using message_id, in_reply_to, and references fields:
Spam Detection¶
Implement basic spam detection:
const from = results['task_54123_from'];
const subject = results['task_54123_subject'];
const body = results['task_54123_body_text'];
// Basic spam indicators
const hasSpamWords = /viagra|casino|lottery|winner/i.test(subject + body);
const suspiciousSender = !from.includes('.com') && !from.includes('.net');
const tooManyLinks = (body.match(/http/g) || []).length > 5;
return {
is_spam: hasSpamWords || suspiciousSender || tooManyLinks,
};
Email Categorization¶
Automatically categorize emails using AI:
- Email Trigger
- AI Prompt - "Categorize this email as: support, sales, billing, or other"
- If Task - Route based on category
Scheduled Email Checking¶
The system checks for new emails every 1-5 minutes automatically. You cannot customize this interval.
Frequently Asked Questions¶
Can I monitor multiple email addresses?¶
Yes, either:
- Create multiple workflows, each with one Email Trigger
- Or connect one account and use matching rules for different addresses
Does this work with shared mailboxes?¶
Yes for Microsoft 365 shared mailboxes. For Gmail, use group email addresses.
Can I delete emails after processing?¶
No, the Email Trigger only reads emails. To delete, you would need to use the email provider's API directly in a Code task.
What happens if I receive thousands of emails?¶
Each email triggers the workflow independently. For high-volume scenarios:
- Use very specific matching rules
- Consider batch processing with a Schedule trigger instead
- Monitor execution costs
Can I access email headers?¶
Yes, all standard email headers are available in the output. Use JSON notation to access specific headers:
How quickly does the workflow trigger?¶
Usually within 1-5 minutes of email receipt. This varies based on system load.
Can I trigger on sent emails (not just received)?¶
No, only incoming emails trigger workflows. For sent emails, use your email provider's webhooks or API.
What's the attachment size limit?¶
Generally 25MB per attachment. Larger attachments may not be processed successfully.
Can I move processed emails to a folder?¶
Not directly. You would need to use the email provider's API in a Code task to move emails after processing.
Next Steps:
- Form Submission Trigger - Trigger from website forms
- Webhook In Trigger - Trigger from external systems
- AI Prompt Task - Use AI to parse email content