Setting Up Mailgun

The aACE+ Mailgun integration allows you to send and receive emails from within your aACE system. Mailgun is a product from Rackspace, a leader in transactional email. It is the recommended email product, due to its ease of setup, enhanced error capturing, and reliability.

As a transactional email program, Mailgun is designed for email-based solutions that may not involve a person. Think of Mailgun as an email “handler” — there isn’t an “inbox”, but rather a database of records that are processed from emails (incoming) or processed into emails (outgoing). aACE periodically queries this database for new records that have been created, then downloads them as incoming emails. Within the system, when a user initiates an email to be sent by the system — via the Email Viewer, Notices, or using “send email” actions in Orders, Invoices, and Purchase Orders — rather than opening the mail client, aACE creates a record in the Mailgun database and indicates for it to be sent as an email. This enables emails to be sent from email accounts other than the individual sending the email.

Setting up your aACE+ Mailgun integration includes eight steps:

Step 1: Sign Up for Mailgun

https://signup.mailgun.com/new/signup

By signing up for your own account (rather than using a common account managed by aACE Software), your email communications are siloed and inaccessible to anyone outside your organization, including aACE Software.

Step 2: Create a Sub-Domain

Create a sub-domain under your company's primary domain (e.g. mg.mycompany.com). Please consult with your IT administrator to accomplish this.

Your sub-domain will be used for aACE-related incoming and outgoing emails. Your primary domain should not be used because it may interfere with your organization’s normal incoming and outgoing emails. Neither aACE nor Mailgun will need access to your email server, so your primary domain can remain unchanged. 

For additional information on selecting a domain, please consult this help guide from Mailgun: How do I pick a domain name for my Mailgun account? 

Note: If technical limitations make it impossible to create a sub-domain, another option is to create a separate domain (e.g. www.mycompany.org). This method would allow you to receive incoming emails into aACE, but not reliably send outgoing emails — the messages would be originating from an unrecognized domain and would likely be flagged as spam.

Step 3: Add the Sub-Domain to Mailgun

Log into Mailgun and add your new sub-domain to your account. For additional information, please consult this help guide from Mailgun: How do I add a domain?

Step 4: Add DNS Records to Verify the Sub-Domain

TXT and MX records need to be added to your new sub-domain. Please consult with your IT administrator to accomplish this. 

For additional information on verifying your domain, please consult this help guide from Mailgun: How do I verify my domain?

Note: The Mailgun control panel indicates that MX records may be optional, depending on your implementation. To fully utilize the aACE+ Mailgun integration, both TXT and MX records are required.

Step 5: Create a Route

The route establishes that emails sent to your new domain (e.g. aace@mg.yourcompany.com) will be stored and available to aACE for retrieval. For additional information on setting up a route, please consult this help guide from Mailgun: How do I setup a route?

Set up the Mailgun catching route with these settings:

  • Expression Type: Catch All
  • Actions: Store and notify
  • Priority: 0
  • Description: "Store all incoming emails for retrieval from aACE"

We recommend that you also configure an optional “Forward” route to relay all emails to an external email account that you manage (e.g. aace@yourcompany.com). This email account functions as a backup. Mailgun only stores 3 days of emails; if the automatic process stops temporarily, emails may be lost unless you have a backup.

Set up the Mailgun forwarding route with these settings:

  • Expression Type: Catch All
  • Actions: Forward; aace@yourcompany.com
  • Priority: 1
  • Description: "Forward all incoming emails to backup email account"

Step 6: Input Credentials into aACE

After you have installed the aACE integration file, proceed with the following steps:

  1. Login to aACE and navigate to Menu > System Admin > Preferences > Database Management.
  2. In the Integrations section, mark the flag for Email Integration.
  3. Next to Email Integration, click the link to Open Settings
  4. In the Email Integration Settings left-hand panel, click Mailgun.
  5. Enter the setup information from your Mailgun account:
    • Domain — In Mailgun, navigate to the Domains tab and click your sub-domain.
    • API Key & Public API Key — In Mailgun, navigate to Account Security > API Security.
      (For more information, please consult this help guide from Mailgun about locating Mailgun credentials.)
  6. Verify the credentials are entered correctly by clicking Test
  7. Close the confirmation message and in the left-hand panel, click General Settings.
  8. Mark the flags to fully enable the aACE integration:
    • Enable Incoming Email
    • Enable Outgoing Email
    • Enable Test Mode (optional) — This will route all outgoing emails to the email account you specify. This allows you to see how the integration functions without sending test messages to all your team members.
  9. Close the Email Integration settings window, then, at the System Preferences module, click Automation Schedules.
  10. Locate and mark the flag for the Retrieve Incoming Emails schedule.
  11. Locate and mark the flag for the Send Outgoing Emails schedule.
  12. Click Commit Updates.

Step 7: Run a Test

Ensure that your email account is present in aACE (e.g. on a Team Member, Company, or Contact record). If the sending email address is not found within the system, then aACE considers the message as junk mail. In other words, if you will be sending the test message from “myname@yourcompany.com”, then the email address “myname@yourcompany.com” must be present on an existing aACE record.

In your email client, send a test email to your aACE email address (e.g aace@mg.yourcompany.com). Then verify these results:

  • The email does not bounce back with an error message in your email client.
  • Log into Mailgun. Navigate to  Logs. Both a “Routed” log and a “Stored” log should be present, each showing the subject line of your test email.
  • Log into aACE. Navigate to Menu > CRM & Sales > Emails. Your test email should display there within a few minutes. (Note: You may need to click the Search icon () to display the list of emails.)

Do More with Mailgun

The transactional aspect of Mailgun allows for some sophisticated use cases. In our documentation, we summarize email functionality by saying that emails sent to “aACE@mg.yourdomain.com” will download into aACE. This is a simplification. In fact, an email sent to any address on the sub-domain (e.g. superfragilisticexpialidocious@mg.yourdomain.com) will download into aACE. 

This provides the foundation for a fairly powerful customization: the local-part of the email (i.e. the part before the @ symbol) can be programmed to trigger an event in aACE (e.g. neworder@mg.yourdomain.com or newexpense@mg.yourdomain.com). The local-part can tell aACE what action to perform, while the body of the email can provide the content for that action.

Although we do not recommend automatically sending emails, if you would like to pursue a feature set that includes an emailing component, that would be done using Mailgun.