Skip to main content

Email to Interaction

Organizations can trigger the automatic creation of Medical Inquiries within the module through the use of email. When configured, any time registered email addresses are included on an email in the To, CC, or BCC address lines, custom processing is invoked to ensure a corresponding Interaction (Case) is created with the relevant data to correctly route the Interaction to the appropriate groups for subsequent processing. All inbound email attachments from Adverse Events, Product Quality Complaints, Requests, and Fulfillments are attached back to the record instead of only to the Interaction.

To configure the custom Apex email service, perform the following steps:

  1. Set up email service for your corporate domain:

    1. In the Quick Find box in Setup, search for and select Email Services.

    2. If an email service does not already exist in , click New email service and fill out the fields in the Email Service Information section as shown in the table below.

FieldRecommended valueRequired value
Email Service NameMED Email Handler
Apex ClassMED_InboundEmailHandler
Accepts AttachmentsAll
Advanced Email Security Settings :::: note ::: title ::: While it is recommended you turn this on to reduce spam, it may cause some emails to be rejected erroneously. Visit Salesforce's Define Email Services topic for more information. ::::Selected
Accept Email FromLeave blank to receive all email addresses (subject to security settings).
Convert Text Attachments to Binary AttachmentsSelected
ActiveSelected

Note: recommends that at a minimum, Failure Response settings to be set to Bounce message. further recommends you enable requeue (when applicable) and set "Enable Error Routing" to send emails to a monitored email box to facilitate notifications of issues. For more information, reference the Failure Response Settings section below.

  1. Set Failure Response Settings as shown in the table below.
FieldRecommended ValueRequired Value
Over Email Rate Limit ActionRequeue
Deactivated Email Address ActionBounce
Deactivated Email Service ActionBounce
Unauthenticated sender actionBounce
Unauthorized sender actionBounce
Enable Error RoutingSelected
Route Error Emails to This Email AddressA monitored email address. Error handling emails will go here and nowhere else.

Warning: Failure to set failure response settings will cause data loss. Salesforce's default settings will discard emails with no log, history, or reason.

  1. Click Save.

  2. Navigate to the Global Setting (MED_Global_Setting__mdt) custom metadata type.

  3. Click Manage Global Settings.

  4. Click Global Setting.

  5. Under the General Settings section, enter the domain to be used in Email Services in the Email Service Domain field (e.g., mydomain.com).

  6. Click Save.

  7. Create new email addresses under the domain:

    1. Navigate back to Email Services in Setup and select the email handler that the new email addresses will live under.

    2. Click New Email Address and fill out the fields in the Email Address Information section as shown in the table below.

FieldValue
Email Address NameUnique name for the email address.
Email addressThe local name of the email address (i.e., if the email address is support@mydomain.com, the local name is support).
ActiveSelected
Context UserThe user who can create cases, requests, email messages, and search all accounts. It is recommended to use an integration user for this. :::: note ::: title ::: Case assignment rules will be run when the case is created. ::::
Accept Email FromBlank to receive all email addresses.
  1. Click Save. The new email address(es) and Email Service Domain will be listed under the Email Addresses section. Copy the long Salesforce generated email address.

  2. Create an organization-wide email address for your new email address (e.g., support@mydomain.com).

  3. Set up email forwarding on your email server to forward emails from the new email address (e.g., support@mydomain.com) to the long Salesforce generated email address (e.g., support@s-277kk53j2f8thrl1zyoqg4r8j31mdso3kdtmljo708mrtwuilb.8b-2lfijao34.as62.apex.sandbox.salesforce.com).

  4. (Optional) Set a default country when new Interactions (Cases) are created by entering the full email address (e.g., support@mydomain.com) in the Email2Case Emails field in the Local Settings record linked to the desired default country.

Failure Response Settings

The failure response settings determine how the email service responds should an attempt to access the service fails. Configuring response options is required to prevent the loss of emails.

Failure types include:

  • Over Email Rate Limit Action

  • Deactivated Email Address Action

  • Deactivated Email Service Action

  • Unauthenticated Sender Action

  • Unauthorized Sender Action

Failure response options are:

  • Bounce message

  • Discard message

  • Requeue message (over email rate limit action only)

For more details on the above Failure Response settings, visit Salesforce's Define Email Services documentation.

To configure response options:

  1. In Setup, search for and select Email Services.

  2. Click Edit next to the desired Email Service.

  3. For each failure type, select a response action from the dropdown options: Discard message, Bounce message, Requeue message.

  4. Click Save.