Skip to main content

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:

  1. Verify the person who forwarded the email is an Autotask Resource (internal staff)
  2. Extract the original sender's email address and subject from the forwarded email body
  3. Look up the original sender as a Contact in Autotask
  4. Create an Opportunity on the Contact's Account, owned by the forwarding Resource
  5. If any step fails, bail out and let a fallback rule handle the email

Related pages:


Before You Start

  1. Create a dedicated mailbox for this workflow (for example, [email protected])
  2. Share the address with your sales team so they know where to forward customer emails

Step 1: Create the Rule

  1. Open your mailbox and click Add New Rule
  2. Name it Process Forwarded Email and Create Opportunity
  3. Leave the Expression empty
Start from the library

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.

  1. Click Add New Action, select API: Query for One Object, click OK
  2. Name the step Verify Sender is Autotask Resource
  3. Set Entity Type to Resource
  4. Add query conditions (use an OR group for all three email fields):
    • Active equals 1
    • OR group:
      • Email equals {{email.from.address}}
      • Email2 equals {{email.from.address}}
      • Email3 equals {{email.from.address}}
  5. 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.

  1. Click Add New Action, select Stop Processing This Rule, click OK
  2. Name the step Stop If Not a Resource
  3. Set Only perform this action if: custom.resource.id is 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.

  1. Click Add New Action, select Perform a Regular Expression Match, click OK
  2. Name the step Extract Original Sender
  3. 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
  1. Set Input to {{email.body}}
  2. In Store results in variable, enter original_sender

Then add a second regex step to capture the original subject:

  1. Click Add New Action, select Perform a Regular Expression Match, click OK
  2. Name the step Extract Original Subject
  3. Set Pattern to: /Subject:\s*(?P<body>.+)/i
  4. Set Input to {{email.body}}
  5. 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.

  1. Click Add New Action, select API: Query for One Object, click OK
  2. Name the step Find Contact for Original Sender
  3. Set Entity Type to Contact
  4. Set Only perform this action if: custom.original_sender.address is not empty
  5. Add query conditions (use an OR group for all three email fields):
    • Active equals 1
    • OR group:
      • EmailAddress equals {{custom.original_sender.address}}
      • EmailAddress2 equals {{custom.original_sender.address}}
      • EmailAddress3 equals {{custom.original_sender.address}}
  6. In Store results in variable, enter contact

Step 6: Create the Opportunity

  1. Click Add New Action, select API: Create an Object, click OK
  2. Name the step Create Opportunity
  3. Set Entity Type to Opportunity
  4. Set Only perform this action if: custom.contact.id is not empty
  5. Populate the required fields (fields marked with an asterisk are required):
FieldValue
AccountIDUnlock the field, enter {{custom.contact.accountId.id}}
ContactIDUnlock the field, enter {{custom.contact.id}}
OwnerResourceIDUnlock 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)
StageSelect an appropriate stage (for example, First Contact or Qualification)
StatusActive
Probability50 (or your preferred default)
Amount0
Cost0
CreateDate{{date to_tz="Autotask"}}
ProjectedCloseDate{{date add="1 month" to_tz="Autotask"}}
UseQuoteTotals0
Description{{email.body}}
  1. In Store results in variable, enter opportunity
About the owner

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}}.

Date helper and timezones

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

  1. Click Add New Action, select Stop Processing This Message Completely, click OK
  2. Name the step Stop If Opportunity Created
  3. Set Only perform this action if: custom.opportunity.id is 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.

  1. Click Add New Rule
  2. Name it Bounce Unprocessed Email
  3. Leave the Expression empty
  4. 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

  1. Process Forwarded Email and Create Opportunity (stops if opportunity created)
  2. Bounce Unprocessed Email (only fires if rule 1 did not stop)

Test the Workflow

  1. From your email client, compose an email to a test address (or use a real customer email)
  2. Forward it to your opportunity mailbox address
  3. 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
  4. 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