# 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="/files/6nvSjY4ite2lSODHvVmr" 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="/files/ll7ZYNwJgqXkrRTZNSG7" alt="" width="375"><figcaption></figcaption></figure>

<figure><img src="/files/lQAEzVjZknZb8pmbt453" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/CCDtX2wWoIeejf66ZonR" 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="/files/XfowakKb6NwrGRq8r2Md" alt="" width="563"><figcaption></figcaption></figure>

<figure><img src="/files/KBx9C21DPYuo5DUMdHvo" alt="" width="563"><figcaption></figcaption></figure>

<figure><img src="/files/yG1FbHcBigIhuxeOdIRg" 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="/files/K3FfGNIvMGj0uHDy475Y" 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="/files/hL95aOh86tAi5FBJt6cW" alt=""><figcaption></figcaption></figure>
   3. Navigate to **Users** > **Active Users**.<br>

      <figure><img src="/files/ZXLqXSUI5pFnl499Ywpy" alt=""><figcaption></figcaption></figure>
   4. **Select the User**:<br>

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

      <figure><img src="/files/JouMum6ck3wgXd2TZe3K" 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="/files/rjNunSnVBd0f0UOMRcL0" 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sangamcrm.com/sangam-crm/outgoing-email-setup.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
