# Setting up Approved Emails

<div class="note-border alert-info">
  <div class="alert alert-info" role="alert">
    <div><i class="far fa-info-circle"></i></div>
    <div class="alert-text">
      <p><strong>Note</strong>: Vault users must have access to the <em>Events API</em> permission for approved emails to function properly.</p>
    </div>
  </div>
</div>



You can set up an approved email and make it available for CRM in a few simple steps:

  * Create a template and upload an _Assets_ rendition.
  * Optional: Add relationships between the email template and content documents in the Vault using the [provided relationship types](/en/lr/11974/#relationship-types).
  * Optional: Create one or more email fragments. Add relationships between the email fragments and other documents in the Vault using the [provided relationship types](/en/lr/11974/#relationship-types). Upload an _Assets_ rendition if needed.
  * Optional: If needed, update the download settings on the attached documents.
  * Optional: Create one or more template fragments and upload _Assets_ renditions for each.
  * Move the template, template fragments, and email fragments into _Staged_ state for a staging test. Users can do this through a workflow or a configured state change user action.
  * Move the template, template fragments, and email fragments into _Approved_ state so that CRM users can access them.
  * Optional: Generate a preview of your email templates for different devices and browsers with the [Litmus integration](/en/lr/36971/).

Note that Vault does not support [Security Overrides](/en/lr/2942/) on any document fields used for Approved Email.

<div class="note-border alert-info">
  <div class="alert alert-info" role="alert">
    <div><i class="far fa-info-circle"></i></div>
    <div class="alert-text">
      <p><strong>Note</strong>: Vault users must be licensed for <em>Approved Email</em> to use its functionality. Approved Email document types, such as <em>Email Template</em>, <em>Email Fragment</em>, <em>Master Email Fragment</em>, and <em>Template Fragment</em> are inactive in Vault without the proper license. Attempting to upload documents to an inactive document type can result in a server error.</p>
    </div>
  </div>
</div>



## How to Set Up Email Templates

To set up an email template:

  1. [Create a new document](/en/lr/15085/) with the document type _Email Template_. Include the HTML file as the source file. If your Vault uses the [BEE](/en/lr/33820/) email template editor, create a placeholder and select **Edit Email** from the document's actions menu to configure the HTML.
  2. Under **Assets** in the document fields, [upload a ZIP file](/en/lr/1403/#upload) with the asset files (images, etc.) used in the email template's HTML. Note that file names can't include certain special characters (**%**, **/**, **?**). If your Vault uses the content/_comm_medical_share/bee-email-template-editor.md email template editor, Vault generates this ZIP file automatically.
  3. Optional: [Add relationships](/en/lr/562/) between the email template and related documents (prescribing information, etc.) using the [provided relationship types](/en/lr/11974/#relationship-types).
  4. Optional: Under **Related Email Fragments** in the document fields, search for and select the email fragments. See details [below](/en/lr/12080/#restrict-fragments).
  5. Set the **Restrict Fragments by Product** field. See details [below](/en/lr/12080/#restrict-fragments).
  6. Optional: Select a **Consent Check** setting.
  7. Set the **Survey** field.

### About the Consent Check Picklist {#consent}

The _Consent Check_ picklist provides Admins another level of granularity to determine how consent is applied.

  * Select **Yes** and Vault will only send emails to a recipient if valid consent exists.
  * Select **No** and Vault will send emails regardless of consent status.
  * Select **Default** or do not make a selection.
  * <a class="external-link " href="https://crmhelp.veeva.com/doc/Content/CRM_topics/Multichannel/ConsentCapture/AdvFunct/CCReceipts.htm" target="_blank" rel="noopener">Receipts<i class="fa fa-external-link" aria-hidden="true"></i></a> and <a class="external-link " href="https://crmhelp.veeva.com/doc/Content/CRM_topics/Multichannel/ConsentCapture/AdvFunct/ConfirmationEmails/DoubleOptIn.htm" target="_blank" rel="noopener">Double Opt-in<i class="fa fa-external-link" aria-hidden="true"></i></a> do not enforce consent.

Vault applies consent settings from the _Consent Check_ picklist only to emails you create from the specific template you are currently configuring. Consent check settings for other emails are not affected.

## How to Set Up Email Fragments

To set up an email fragment:

  1. [Create a new document](/en/lr/15085/) with the document type _Email Fragment_. Include the HTML file as the source file and be sure to select one (1) product in the document fields.
  2. Optional: Under **Assets** in the document fields, [upload a ZIP file](/en/lr/1403/#upload) with the asset files (images, etc.) used in the email fragment's HTML.
  3. [Add relationships](/en/lr/562/) between the email fragment and related documents (prescribing information, etc.) using the [provided relationship types](/en/lr/11974/#relationship-types).
  4. Set the **Survey** field.

### Configuring Entry Actions

You can also add the _Set state for prior Email Fragment versions_ [entry action](/en/lr/12399/) which, when configured on an _Approved Email_ lifecycle state, sets prior email fragments to the selected state. This action only transitions _Email Fragment_ documents, and does not affect _Master Email Fragments_. 

For example, while configuring the entry action on the _Deleted_ state, you select the _Deleted_ state as the state Vault should set the prior fragments to. When document VV-1234 reaches the _Deleted_ state in version 1.3, Vault also sets the previous versions to the _Deleted_ state.


## How to Set Up Template Fragments

To set up a template fragment:

  1. [Create a new document](/en/lr/15085/) with the document type _Template Fragment_. Include the HTML file as the source file.
  2. Under **Assets** in the document fields, [upload a ZIP file](/en/lr/1403/#upload) with the asset files (images, etc.) used in the template fragment's HTML.

## How to Set Up Key Messages

To add key messages:

  1. Add the shared _Key Message_ object reference field to the _Email Template_ and _Email Fragment_ document types. Learn more about [Managing Document Fields](/en/lr/592/).
  2. Ensure that a _Key Message_  (`key_message__v`) object record exists in Vault for each key message that exists in CRM The values in the _External ID_ (`external_id__v`) fields of both object records must be identical.
  3. From the **Library**, edit each _Email Template_ or _Email Fragment_  document to add the desired object reference in the **Key Message** field.
  4. Update Key Messages mapping in the <a class="external-link " href="https://crmhelp.veeva.com/doc/Content/CRM_topics/Multichannel/ApprovedEmail/InitialConfig/ConfiguringAE/AECRMVaultIntegration.htm" target="_blank" rel="noopener">Approved Email Admin page in CRM<i class="fa fa-external-link" aria-hidden="true"></i></a>.
  5. From Vault, [sync with CRM](/en/lr/30147/#sync).

## How to Set Up Master Email Fragments

To set up a email master fragment:

  1. [Create a new document](/en/lr/15085/) with the document type _Master Email Fragment_. Include the HTML file as the source file and be sure to select at least one product in the document fields.
  2. Optional: Under **Assets** in the document fields, [upload a ZIP file](/en/lr/1403/#upload) with the asset files (images, etc.) used in the master email fragment's HTML.
  3. Add relationships between the master email fragment and related documents (prescribing information, etc.) using the [provided relationship types](/en/lr/11974/#relationship-types).

## How to Use Master Email Fragments

You can use master email fragments to automatically create email fragments from a document in Vault. Note that this action is only available on documents that meet [certain criteria](/en/lr/12080/#create_fragment_criteria). To create an email fragment from a master:

  1. Open the original document that you want to turn into an email fragment.
  2. From the document's actions (gear) menu, select **Create Email Fragment**.
  3. In the **Select Master Email Fragment** dialog, choose a master email fragment.
  4. Click **Create** to start creating the new _Email Fragment_ document. This may take a few minutes.

### How Creation from Master Email Fragments Works

When you create a new _Email Fragment_ document from a master email fragment and an original document, Vault:

  * Creates a new document with the _Email Fragment_ document type and sets its status to _Draft_
  * Copies the following field values from the original document to the new _Email Fragment_ document: _Name_, _Title_, _Country_, _Detail Group_, and _Product_
  * Copies the following relationship and field values from the _Master Email Fragment_ document to the new _Email Fragment_ document: _Embedded Viewer_, _CRM_ _Territory_, _Lifecycle_, _Assets_, _Related ISI_, _Related PI_, and _Other Related Documents_
  * Copies the source file from the _Master Email Fragment_ document to the new _Email Fragment_ document, with Vault tokens replaced by their corresponding values; for example, the token _${title\_\_v}_ is replaced by the original document's _Title_ value.
  * Creates a _Related Pieces_ (PromoMats) or _Related Medical Content_ (MedComms) relationship on the new _Email Fragment_ document, pointing to the original document

### Related Permissions & Original Document Criteria {#create_fragment_criteria}

To access the **Create Email Fragment** action:

  * You must have a security profile that grants the **Approved Email** permission. By default, this is only available to System Admins and Vault Owners.
  * You must have the **Create Document** permission on the _Email Fragment_ document type. This is assigned through document type configuration.
  * The original document cannot be a binder.
  * The original document cannot be any of the following document types: _Email Template_, _Template Fragment_, _Email Template_, or _Master Email Template_.
  * The original document must be in a lifecycle state where an Admin has set up the **Create Email Fragment** user action.

### Automatically Creating Email Fragments {#automatically-create-fragments}

Vault automatically creates Approved Email fragments. To configure automatic master email fragment creation:

  1. Navigate to **Configuration > Document Fields** and [add the **Publish for Veeva CRM (Email)** field](/en/lr/4884/#use-shared-field) to applicable document types.
  2. On the **Document Fields** page, click the **Master Email Fragment** document type.
  3. Click **Targeted Document Type**, then click **Edit**.
  4. Under _Status_, select **Active**.
  5. Click **Save**.

To automatically create email fragments, select the _Publish for Veeva CRM (Email)_ checkbox while creating a document and complete the following fields:

  * _Targeted Document Type_
  * _CRM Product_
  * _Product_
  * _Country_
  * _Language_

<div class="note-border alert-info">
  <div class="alert alert-info" role="alert">
    <div><i class="far fa-info-circle"></i></div>
    <div class="alert-text">
      <p><strong>Note</strong>: Vault does not create fragments from documents created via the <em>Make a Copy</em> action or the Vault API when the <em>Publish for Veeva CRM (Email)</em> checkbox is selected. You can clear the checkbox, create the documents, then reselect the checkbox.</p>
    </div>
  </div>
</div>



Vault matches these fields with the closest corresponding steady state _Master Email Fragments_ and creates an email fragment from the document. If there are multiple matches, Vault creates a fragment for each _Country_ specified.

Vault uses a _Master Email Fragment_ to automatically generate email fragments for the document type indicated in the _Targeted Document Type_ field.

Document field values from the original document transfer to the email fragment.

<div class="note-border alert-info">
  <div class="alert alert-info" role="alert">
    <div><i class="far fa-info-circle"></i></div>
    <div class="alert-text">
      <p><strong>Note</strong>: If the <em>Publish for Veeva CRM (Email)</em> checkbox is unselected, Vault creates email fragments and assigns them to the <em>Deleted</em> state of the <em>Approved Email</em> lifecycle.</p>
    </div>
  </div>
</div>



#### Configuring Entry Actions

You can also add the _Update Email Fragment State_ [entry action](/en/lr/12399/) to document lifecycle states and select the target state of the _Approved Email_ lifecycle. This allows Vault to update auto-published email fragments with a [relationship](/en/lr/11974/) to a given document. You cannot configure this entry action on the _Approved Email_ lifecycle. Before configuring this entry action, verify that the _Approved Email_ lifecycle is defined on the _Email Fragment_ document type.

By default, the steady state for email fragments requires a set _Expiration Date_. If you want the _Update Email Fragment State_ entry action to send the fragment to the steady state, you'll first need to navigate to **Configuration > Document Fields** and click the **Expiration Date** field. Click **Edit** and clear the **Do not copy this field during Make a Copy** checkbox, then click **Save**. This enables Vault to automatically populate the _Expiration Date_ and allows the entry action to set the fragment to the steady state. If you do not want Vault to copy the _Expiration Date_ for documents using other lifecycles, you can add an [event action](/en/lr/51700/) to the affected lifecycle states to set the _Expiration Date_ field to _NULL_.

<div class="note-border alert-info">
  <div class="alert alert-info" role="alert">
    <div><i class="far fa-info-circle"></i></div>
    <div class="alert-text">
      <p><strong>Note</strong>: If you disable <strong>Publish Approved Email Fragments for Veeva CRM</strong> after configuring the entry action, Vault will not update the email fragment’s lifecycle state.</p>
    </div>
  </div>
</div>



#### Configuring Notifications

When the fragment creation process is complete, you'll receive an email and a Vault notification. The notifications include a list of the created fragments and a list of any failures. You can [edit these notifications](/en/lr/2157/) by navigating to  **Configuration > Notification Templates**.

## HTML Source Files

HTML that you upload as source files for Approved Email must be UTF-8 encoded prior to uploading.

## Document Download & Fit Options

If your Vault's configuration allows this, you will see an **External Viewer** section in the field panel of the Doc Info page for documents that may be attached to emails. From here, you will see:

  * **Allow PDF Download**: This multi-select object picklist references the _Website_ object. To allow viewable rendition downloads from the Approved Email external viewer, select _Approved Email_.
  * **Allow Source Download**: This multi-select object picklist references the _Website_ object. To allow source file downloads from the Approved Email external viewer, select _Approved Email_.
  * **Document Fit**: This picklist lets you specify the default document zoom in the Approved Email viewer: _Fit Width_ or _Fit Height_.

If you allow downloading, recipients will see a **Download** menu in the viewer when they open linked documents. Note that downloading is not allowed for video files, regardless of the document settings.

## External Viewer Tracking

When configured, you can track and report on the number of views per document viewed through an [external viewer](/en/lr/578905/).

## Restricting Email Fragments {#restrict-fragments}

 Some organizations may need to restrict which email fragments a user in Approved Email may select for a given email template. Vault allows you to do this in two ways, described below. Note that setting up these restrictions requires additional configuration in Veeva CRM.

  * _Related Email Fragments_ relationship type: You can choose to restrict email fragments by adding relationships between an email template and specific email fragments using this relationship type. If this setting is enabled, users in Approved Email will only be able to select email fragments from those which are explicitly linked to the email template. When **Publish Approved Email Fragments for Veeva CRM** is enabled, the relationship is version-specific.
  * _Restrict Fragments by Product_ document field: For each email template, this field allows you to restrict the list of fragments that users can insert into an email template, based on the _Product_ specified for the email template. This field defaults to _Yes_, which restricts fragments by product.

## Email Template Type

_Email Template Type_ is a standard field on the _Email Template_ document type. The value that you select in this field dictates where, in CRM, the email template is available for selection. For example, if a user is scheduling a CoBrowse session and uses the "Send Email Invitation" button, that user can only select email templates where _CoBrowse_ was selected in the _Email Template Type_ field. If you choose not to use this field, all email templates will have _Standard Template Type_.

### Secure Message Notification Email Templates 

With the _Secure Message Notification Template_, users can secure an _Email Template_ document type by creating a document relationship between the _Secure Message Notification Template_ and the _Email Template_. Users can select **Secure Message Notification Template** from the _Email Template_ picklist to add a _Related Secure Message Notification_ to a document. Vault then transfers the _Secure Message Email Template_ to Vault CRM and distributes the secure message via Approved Email. When the recipient receives the email and clicks the secure message link, they are redirected to the My Engage Portal to log in and view the secure content.

## Content Type Object & Document Field

The _Content Type_ (crm\_content\_type\_\_v) object allows you to associate specific content types, such as medical communications and safety information, with email templates. Your Admins can define content types.

_Content Type_ is a standard field on the _Email Template_ document type. With this field, you can specify the related content type for an email template.

<div class="note-border alert-info">
  <div class="alert alert-info" role="alert">
    <div><i class="far fa-info-circle"></i></div>
    <div class="alert-text">
      <p><strong>Note</strong>: <em>Content Type</em> is initially inactive; an Admin must set its status to <em>Active</em> for use.</p>
    </div>
  </div>
</div>



## Email Domain Field

The _Email Domain_ (email\_domain\_v) field allows you to specify a domain for sending approved emails. It overrides the value defined in CRM.

## File Size Limit

These limits apply to renditions as well as source files:

  * Any file must be under 4GB in size.
  * You cannot upload zero (0) byte files.
