Create Autotask Opportunity from Forwarded Email
This tutorial walks through building a workflow where a sales rep or account manager forwards a customer email to a dedicated Email2AT address, and Email2AT automatically creates a new Autotask Opportunity for that customer. If the customer cannot be identified, the email is bounced back to the sender so nothing is silently lost.
Overview
The workflow processes forwarded emails in five stages:
- Verify the person who forwarded the email is an Autotask Resource (internal staff)
- Extract the original sender's email address and subject from the forwarded email body
- Look up the original sender as a Contact in Autotask
- Create an Opportunity on the Contact's Account, owned by the forwarding Resource
- If any step fails, bail out and let a fallback rule handle the email
Related pages:
Before You Start
- Create a dedicated mailbox for this workflow (for example,
[email protected]) - Share the address with your sales team so they know where to forward customer emails
Step 1: Create the Rule
- Open your mailbox and click Add New Rule
- Name it
Process Forwarded Email and Create Opportunity - Leave the Expression empty
Email2AT includes a library rule called "Process forwarded message or stop if sender is not a valid Autotask resource." Import it and modify it to create an Opportunity instead of a Ticket. This saves you from building the resource verification and sender extraction steps from scratch.
Step 2: Verify the Sender Is an Autotask Resource
Only internal staff should be able to create opportunities by forwarding emails. This step verifies the forwarder.
- Click Add New Action, select API: Query for One Object, click OK
- Name the step
Verify Sender is Autotask Resource - Set Entity Type to
Resource - Add query conditions (use an OR group for all three email fields):
Activeequals1- OR group:
Emailequals{{email.from.address}}Email2equals{{email.from.address}}Email3equals{{email.from.address}}
- In Store results in variable, enter
resource
Step 3: Stop If Not a Resource
If the sender is not found as a Resource, stop this rule so a fallback rule can handle the email.
- Click Add New Action, select Stop Processing This Rule, click OK
- Name the step
Stop If Not a Resource - Set Only perform this action if:
custom.resource.idis empty
Step 4: Extract the Original Sender
Use regular expressions to extract the original sender's email address and subject line from the forwarded email body.
- Click Add New Action, select Perform a Regular Expression Match, click OK
- Name the step
Extract Original Sender - Set Pattern to a regex that finds
From:followed by an email address in the forwarded body, for example:
/From:\s*(?:.*?<)?(?P<address>[\w.\-!#$%&'*+\/=?^`{|}~]+@[\w.\-]+\.\w+)>?/i
- Set Input to
{{email.body}} - In Store results in variable, enter
original_sender
Then add a second regex step to capture the original subject:
- Click Add New Action, select Perform a Regular Expression Match, click OK
- Name the step
Extract Original Subject - Set Pattern to:
/Subject:\s*(?P<body>.+)/i - Set Input to
{{email.body}} - In Store results in variable, enter
captured_body
Step 5: Query Autotask for the Contact
Look up the original sender as a Contact in Autotask.
- Click Add New Action, select API: Query for One Object, click OK
- Name the step
Find Contact for Original Sender - Set Entity Type to
Contact - Set Only perform this action if:
custom.original_sender.addressis not empty - Add query conditions (use an OR group for all three email fields):
Activeequals1- OR group:
EmailAddressequals{{custom.original_sender.address}}EmailAddress2equals{{custom.original_sender.address}}EmailAddress3equals{{custom.original_sender.address}}
- In Store results in variable, enter
contact
Step 6: Create the Opportunity
- Click Add New Action, select API: Create an Object, click OK
- Name the step
Create Opportunity - Set Entity Type to
Opportunity - Set Only perform this action if:
custom.contact.idis not empty - Populate the required fields (fields marked with an asterisk are required):
| Field | Value |
|---|---|
| AccountID | Unlock the field, enter {{custom.contact.accountId.id}} |
| ContactID | Unlock the field, enter {{custom.contact.id}} |
| OwnerResourceID | Unlock the field, enter {{custom.resource.id}} (the person who forwarded the email) |
| Title | {{email.subject}} (the forwarder should set the subject to the desired opportunity name) |
| Stage | Select an appropriate stage (for example, First Contact or Qualification) |
| Status | Active |
| Probability | 50 (or your preferred default) |
| Amount | 0 |
| Cost | 0 |
| CreateDate | {{date to_tz="Autotask"}} |
| ProjectedCloseDate | {{date add="1 month" to_tz="Autotask"}} |
| UseQuoteTotals | 0 |
| Description | {{email.body}} |
- In Store results in variable, enter
opportunity
This configuration sets the opportunity owner to the person who forwarded the email. If you prefer to assign it to the account's owner instead, unlock the OwnerResourceID field and enter {{custom.contact.accountId.ownerResourceId}}.
The {{date to_tz="Autotask"}} helper renders the current date in the timezone Autotask expects. Autotask presents and accepts all API dates in the America/New_York timezone; the special Autotask timezone handles this conversion (including Daylight Saving Time) automatically. See Date Timezones for details.
Step 7: Stop If Opportunity Was Created
- Click Add New Action, select Stop Processing This Message Completely, click OK
- Name the step
Stop If Opportunity Created - Set Only perform this action if:
custom.opportunity.idis not empty
If the opportunity was not created (no contact found, no original sender extracted, etc.), the stop is skipped and the next rule in the mailbox fires.
Step 8: Add a Fallback Rule
Create a second rule in the mailbox to handle emails that did not result in an opportunity.
- Click Add New Rule
- Name it
Bounce Unprocessed Email - Leave the Expression empty
- Click Add New Action, select Bounce Email to Sender, click OK
This bounces the email back to the person who forwarded it, letting them know the email could not be processed. They can then create the opportunity manually or fix the issue and forward again.
Rule Order
Process Forwarded Email and Create Opportunity(stops if opportunity created)Bounce Unprocessed Email(only fires if rule 1 did not stop)
Test the Workflow
- From your email client, compose an email to a test address (or use a real customer email)
- Forward it to your opportunity mailbox address
- Open the processing log in History and verify:
- Your Resource was found in step 1
- The original sender was extracted
- The Contact was found in Autotask
- An Opportunity was created on the correct Account
- Open the Opportunity in Autotask and confirm the owner, contact, account, title, and description are correct
To test the fallback: forward an email where the original sender does not exist as a Contact in Autotask. Verify the email is bounced back to you.
Key Takeaways
- Verify the forwarder first: only Autotask Resources should be able to trigger opportunity creation
- Guard every step: use "only perform if" conditions so missing data skips the step gracefully instead of causing errors
- Set the subject line when forwarding: the email's subject becomes the opportunity title, so the forwarder should write a meaningful subject
- Bounce on failure: bouncing the email back is the simplest way to tell the forwarder something went wrong
- Owner defaults to the forwarder: the person who forwards the email becomes the opportunity owner; this can be changed to the account owner if preferred
Related Documentation
- Core Concepts: how rules, actions, and variables work together
- API: Create an Object: creating any Autotask entity
- API: Query for One Object: querying Autotask for a single result
- Perform a Regular Expression Match: extracting data with regex