Creating Custom MetaData Type to show Warning Message for Email Attachments Collective Size on e2a Email Client 


e2a has provided a feature where users can get a warning message on e2a email client when sending out emails if the collective size of email (attachments + email body) is large and attachments will be converted into links upon sending. As the setting of converting an attachment to a link for an outbound email in Salesforce is controlled through the Salesforce Email Attachment setting of the org, e2a will leverage these settings to show the warning message. 

To do so, users will have to create a custom metadata type in the org, which will then be used by e2a to show the warning message by calculating the collective size of email attachments before sending.


Please note that for now it is only applicable for the Salesforce's Email Attachment setting 'Include as attachment up to Salesforce email size limit or as links if more'. Subsequent changes may cover the per attachment scenario in the future. 


Here are the instructions to create the custom metadata type: 

  1. Go to 'Setup' and type 'Custom Metadata Type' in the quick find box
  2. From the results, open 'Custom Metadata Type'
  3. Press on 'New Custom Metadata Type' to create a new Custom Metadata Types
  4. Set the Label as: e2a Customer Settings
  5. Set the Object Name as: e2a_Customer_Settings__mdt (note the "__mdt" gets added automatically)
  6. Set the Description as: This Custom Metadata type holds records related to the maximum email size limit above which all attachments will be converted to links and action to perform when an outbound email from e2a exceeds this limit. If you are using the Salesforce Email Gateway (e2a Default), make sure these settings reflect the Salesforce Email Settings and limits for your org. It is the Salesforce Email Gateway that enforces these limits. e2a can display a warning or stop email submission when using the e2a Email Client according to these settings. For example, setting max email size to 40 MB and trying to send a 39 MB email will not show any e2a warning, however, the email will not get sent by the Salesforce Email Gateway if it's max email size is lower.

You have created a Custom Metadata type now. Please follow the below steps to create a field under it: 

  1. In the same Custom Metadata Type record, look for the 'Custom fields' section and press on 'New'
  2. Select Type: Text (255)
  3. Enter Label as: Value
  4. Enter API Name as: Value__c
  5. Add in Help: Add the value in a name/value pair, using the Label field of the record for the name

Next, user will have to create two records under the newly created metadata type. Please follow the steps to create the required records:

  1. Go to 'Setup' and type 'Custom Metadata Type' in the quick find box
  2. Open the 'Custom Metadata Types' from the result and look for the newly create metadata type i.e. e2a Customer Settings
  3. Press on 'Manage Records' - an option residing on the left side of the metadata type
  4. Press on 'New'
  5. Enter the Name as: EC_ES_Limit_Attachments_To_Link_MB
  6. Enter the Label as: EC - ES Limit Attachments To Link (MB)
  7. Enter the Value as: 35
  • NOTE: This setting means the whole Email size (including attachments) will be compared to this value and if it exceeds this value, all attachments will be converted to links. This is a Salesforce enforced limit and as at 18/20/21, the standard Org limit is 35MB. Setting this limit above or below the actual Salesforce limit of your Org would mean Users may / may not be shown an appropriate warning (if this is the action specified in setting later on in this section).
  1. Press again on 'New' to create the second record
  2. Enter the Label as: EC - Action If Attachments Will Be Links
  3. Enter the Name as: EC_Action_If_Attachments_Will_Be_Links
  4. For the value, select any one option from the three below-mentioned options. Each value has a description under it. Please select accordingly: 
    1. Value: No Action
      Description: This value means, if an attachment will be sent as a link, the User will not be notified that this will occur.
    2. Value: Display Warning
      Description: This value means, if an attachment will be sent as a link because the Email it is attached to exceeds the setting for max Email size, a warning message will be shown to the User before the final submission of the Email. This will give the User the opportunity to reduce the no of attachments, individual attachment size or other Email content as appropriate.
    3. Value: Prevent Sending
      Description: This value means, if an attachment will be sent as a link, because the Email it is attached to exceeds the setting for max Email size, a message will be shown to the User and they will not be able to submit the Email.

You have successfully created a Custom Metadata type.


Note: Neither the Custom Metadata Type nor records will be shipped as part of the package. The user can create the Custom Metadata Type (using details above) and add records of this type for specific settings, should they wish to override the hardcoded defaults.


Please contact us at for any other queries. 



Was this information helpful?

The page cannot be found

The page you are looking for might have been removed, had its name changed, or is temporarily unavailable. Please make sure you spelled the page name correctly or use the search box.