# Outgoing Email Setup

## **Introduction**

This guide covers the steps required to configure outbound email functionality in your CRM using **GMail**, **Office 365 (Microsoft Exchange)**, and **SendGrid**. With this setup, users can send emails directly from the CRM for efficient communication with customers, prospects, and team members.

***

## **1. Prerequisites**

Before starting the setup, ensure you have:

* CRM admin access.
* Access to your GMail, Microsoft Exchange, or SendGrid account.
* SMTP details, App Passwords, or API keys as required.

***

## **2. Configuring GMail in CRM**

### **Step-by-Step Instructions**

<figure><img src="https://3971585481-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdbXYefv4RotYraeWOZHy%2Fuploads%2FFvwqAINyfUI0jpT1wOG4%2FScreenshot%202024-09-06%20at%205.11.59%20PM.png?alt=media&#x26;token=b7c0a51c-cf93-4a12-b3e8-f8617c7b3f55" alt=""><figcaption></figcaption></figure>

1. **Go to Email Settings in CRM**:
   * Navigate to **Admin** > **Channels** > **Email**.
2. **Enter Gmail SMTP Details**:
   * **Email Provider**: Select **SMTP**.
   * **SMTP Mail Server**: Enter `smtp.gmail.com`.
   * **Port**: Use `587` (TLS).
   * **From Email**: Enter your Gmail address.
   * **SMTP Password**: Generate and use a Gmail **App Password** (steps below).

### **How to Generate GMail App Password**

1. **Enable 2-Step Verification**:

<figure><img src="https://3971585481-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdbXYefv4RotYraeWOZHy%2Fuploads%2FHrCHK7lZ6E9v9KiKTQCZ%2FScreenshot%202024-09-06%20at%205.13.09%20PM.png?alt=media&#x26;token=e8351421-3799-42ef-b7c4-2a5c9ee0ad97" alt="" width="375"><figcaption></figcaption></figure>

<figure><img src="https://3971585481-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdbXYefv4RotYraeWOZHy%2Fuploads%2F1XksFxQ1PCo103exsJcc%2FScreenshot%202024-09-06%20at%205.45.59%20PM.png?alt=media&#x26;token=f416244f-f37e-48ba-a1f9-dad0e6877d9c" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3971585481-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdbXYefv4RotYraeWOZHy%2Fuploads%2FmkXPabvEFYMSfdDkjKTe%2FScreenshot%202024-09-06%20at%205.46.09%20PM.png?alt=media&#x26;token=bc0d9630-c64c-47c2-aafc-2e57ea232426" alt=""><figcaption></figcaption></figure>

* Log in to your Google account.
* Go to **Security** and enable **2-Step Verification**.

1. **Generate App Password**:

<figure><img src="https://3971585481-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdbXYefv4RotYraeWOZHy%2Fuploads%2FY7N9ZPWs5TkZdDWAJJgj%2FScreenshot%202024-09-06%20at%205.13.52%20PM.png?alt=media&#x26;token=f507aba0-23e2-42f5-9e09-9349aa91adac" alt="" width="563"><figcaption></figcaption></figure>

<figure><img src="https://3971585481-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdbXYefv4RotYraeWOZHy%2Fuploads%2FWusXz2eN5H4bEvnSZaZX%2FScreenshot%202024-09-06%20at%205.14.09%20PM.png?alt=media&#x26;token=7e4dc037-a789-47c3-8e1e-35fea425410a" alt="" width="563"><figcaption></figcaption></figure>

<figure><img src="https://3971585481-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdbXYefv4RotYraeWOZHy%2Fuploads%2FvEvcIIEaFselyM86o4qf%2FScreenshot%202024-09-06%20at%205.18.19%20PM.png?alt=media&#x26;token=e6fb1262-db7a-4103-9ce5-635c51a5d194" alt="" width="563"><figcaption></figcaption></figure>

* After enabling 2-Step Verification, go to **App Passwords** under **Security**.
* Choose **Mail** for the app, and select **Other** for the device (name it “CRM”).
* Copy the generated App Password and use it in the **CRM Password field**.

1. **Test the Configuration**:
   * Use the **Send Test Mail** option to verify the setup.

***

## **3. Configuring Office 365 Email in CRM**

### **Step-by-Step Instructions**

<figure><img src="https://3971585481-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdbXYefv4RotYraeWOZHy%2Fuploads%2FUQ9AAQsb3ynTQ8EwKaGG%2FScreenshot%202024-09-09%20at%205.16.11%20PM.png?alt=media&#x26;token=2748d6d3-82e0-4a4e-a5a3-ad2f58f5a78c" alt=""><figcaption></figcaption></figure>

1. **Go to Email Settings in CRM**:
   * Navigate to **Admin** > **Channels** > **Email**.
2. **Enter Office 365 Details**:
   * **Email Provider**: Select **SMTP**.
   * **SMTP Mail Server**: Enter `smtp.office365.com`
   * **Port**: Use `587` (TLS).
   * **From Email**: Enter your Office 365 email address.
   * **SMTP Password**: If Multi-Factor Authentication (MFA) is enabled, generate an **App Password** (explained below).
3. **Generate Office 365 App Password** (If MFA is enabled):

   To generate an App Password if MFA is enabled, follow these steps:

   1. **Log in to your** [**Office 365 account**.](https://admin.microsoft.com/)
   2. **Go to the Microsoft 365 Admin Center**: <br>

      <figure><img src="https://3971585481-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdbXYefv4RotYraeWOZHy%2Fuploads%2F98SBkkeb63Lc5olxT9Ym%2FScreenshot%202024-09-09%20at%205.41.59%20PM.png?alt=media&#x26;token=b43be94c-4770-4362-94a1-e67e093d8617" alt=""><figcaption></figcaption></figure>
   3. Navigate to **Users** > **Active Users**.<br>

      <figure><img src="https://3971585481-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdbXYefv4RotYraeWOZHy%2Fuploads%2FeNIbczzCQ2sn1n23erdn%2FScreenshot%202024-09-09%20at%205.42.26%20PM.png?alt=media&#x26;token=ac16c7f3-4b63-4efb-bed8-7df5a36bb1c9" alt=""><figcaption></figcaption></figure>
   4. **Select the User**:<br>

      * In the flyout that appears, select **Mail**.

      <figure><img src="https://3971585481-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdbXYefv4RotYraeWOZHy%2Fuploads%2FmTFLV3ShuZKYV3Lae5c1%2FScreenshot%202024-09-09%20at%205.42.44%20PM.png?alt=media&#x26;token=9fde6172-a911-421a-90cc-5265b233b7ba" alt=""><figcaption></figcaption></figure>
   5. **Manage Email Apps**:
      * Under the **Email Apps** section, select **Manage Email Apps**.
   6. **Verify the Authenticated SMTP setting**:<br>

      * **Unchecked = Disabled**.
      * **Checked = Enabled**.

      <figure><img src="https://3971585481-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdbXYefv4RotYraeWOZHy%2Fuploads%2FnrdoBjT01SbgGbFvFSgo%2FScreenshot%202024-09-09%20at%205.42.56%20PM.png?alt=media&#x26;token=1d499d9d-0330-4142-98b9-02d58a89b280" alt=""><figcaption></figcaption></figure>
   7. **Save changes**.
4. **Test the Configuration**:
   * Use the **Send Test Mail** option to ensure everything is working correctly **If You Cannot See the Option to Generate an App Password**

#### If you don't see the option to generate an [App Password](https://account.activedirectory.windowsazure.com/UserManagement/MfaSettings.aspx), follow these steps

1. **Admin Login**:
   * Log in to the **Microsoft 365 Admin Center**.

2. **Navigate to**:
   * **Users** > **Active Users**.

3. **Select the User** you need to configure.

4. **Go to Multi-Factor Authentication Settings**:
   * Set **Multi-Factor Auth Status** to **Enforce**.

5. **Logout the User**:
   * Ensure the user logs out of all active sessions.

6. **Wait for the Changes to Propagate**:
   * After enforcing MFA, it may take **3 to 4 hours** for the changes to fully propagate and update the user’s roles and permissions. Wait for at least **4 hours** before retrying to generate an App Password.

7. **Generate a New App Password**:
   * After the waiting period, go back to the Microsoft account **security settings** and attempt to generate the **App Password** again.

8. **Copy the App Password**:
   * Once generated, copy the App Password.

9. **Paste the App Password**:

   * Paste the App Password into the **SMTP Password** field in your CRM settings.

10. If you still fail to send the email  check the **Conditional Access** policy and exclude the user from the policy. For guidance, please review the document.\
    <https://learn.microsoft.com/en-us/answers/questions/512954/535-5-7-139-authentication-unsuccessful>

## **4. Configuring SendGrid for CRM**

SendGrid is primarily used for sending bulk marketing emails. Here’s how to integrate SendGrid with your CRM.

### **Step-by-Step Instructions**

1. **Go to Email Settings in CRM**:
   * Navigate to **Admin** > **Channels** > **Email**.
2. **Enter SendGrid API Details**:
   * **Email Provider**: Select **SendGrid**.
   * **From Name**: Enter your preferred sender name (e.g., “CRM”).
   * **API Key**: Enter the **API Key** generated in SendGrid (steps below).
3. **Generate SendGrid API Key**:
   * Log in to your SendGrid account.
   * Go to **Settings** > **API Keys**.
   * Create a new API key, name it, and provide **Full Access**.
   * Copy the API key and paste it into the CRM.
4. **Test the Configuration**:
   * Use the **Send Test Mail** option to ensure the setup works properly.

***

## **5. Troubleshooting Common Issues**

### **Problem: Gmail App Password Not Working**

* **Cause**: Users may be entering their regular Gmail password instead of the App Password.
* **Solution**: Verify that **2-Step Verification** is enabled and an App Password has been generated for the CRM.

### **Problem: Office 365 Fails to Send Emails**

* **Cause**: This can occur if Multi-Factor Authentication (MFA) is enabled but an App Password is not used.
* **Solution**: Generate an **App Password** under **Security & Privacy** in Office 365 and use that in the CRM configuration.

### **Problem: SendGrid Emails Not Sending**

* **Cause**: Incorrect API key configuration or invalid domain settings.
* **Solution**: Verify the API key in SendGrid and ensure that the CRM’s IP addresses are whitelisted in SendGrid.

***

## **6. Best Practices for Email Configuration**

* **Keep App Passwords and API Keys Secure**: Store these credentials in a secure location and avoid sharing them unnecessarily.
* **Test Email Settings Regularly**: Periodically use the **Send Test Mail** feature to ensure configurations remain valid.
* **Monitor Mail Flow Rules in Exchange**: Regularly review and update mail flow rules to adapt to changing email routing needs.
