# Connecting Gmail email to Swarmica
# Connecting a Gmail mailbox via IMAP

:::danger
After connecting Gmail, all messages marked as "Unread" may be imported into Swarmica as tickets. If there are more than 100 such messages, this can overload the system!
:::

<br />

1\. In Swarmica, open **Settings - Channels** and click **Email**.

2\. Click <img height="43" width="100" src="https://support.swarmica.com/attachments/Y/i/Yi36aSdlwWpJHd_0_a/gmail-setup-en-missing-1.png" /> in the upper-right corner.

3\. A window with the main settings will open:

<img height="239" width="717" src="https://support.swarmica.com/attachments/n/o/no5GTuJwW4IVmgYk_a/gmail-setup-en-missing-2.png" />

**Name** — any name for your email channel.

**Recipient** — the email address where you receive messages.

**Sender** — the address from which you will reply to messages.

The incoming and outgoing addresses may be different. For example, you may receive mail in several mailboxes but send all replies from one address.

After entering the main settings, click <img height="37" width="100" alt="&quot;Save&quot;" src="https://support.swarmica.com/attachments/y/R/yR4FNvAHuxqVy3-U_a/gmail-setup-en-missing-3.png" />.

4\. The email settings page will open.

## Filling in the settings in Swarmica

### Incoming mail settings

<img height="548" width="721" src="https://support.swarmica.com/attachments/X/K/XK4NnBz0GERK6bSq_a/gmail-setup-en-1.png" />

1.  **Name** — any name for your email channel.
2.  **Sender name** — the name displayed to recipients, for example, "Support team" and your company name.
3.  **Recipient** — the email address where you receive messages.
4.  **Incoming mail server**: [imap.gmail.com](https://imap.gmail.com).
5.  **IMAP server port**: 993.
6.  **Encryption:** SSL.
7.  **Username** — usually your email address.
8.  **Password** — an app password is required. The steps to create one are described below.
9.  **Folder** — the name of the folder on the IMAP server, if you want Swarmica to receive mail only from a specific folder.
10. **"Check connection"** — click this after entering the settings to verify that they are correct. If you see an error, check the values again.

### Outgoing mail settings

You can send mail through Gmail or through your own SMTP Relay server. To use SMTP Relay, enable the **Use system SMTP server** switch:



Below are the settings for sending mail through Gmail.

<img height="412" width="573" src="https://support.swarmica.com/attachments/R/z/RzLCO17fTOhYdO2e_a/gmail-setup-en-10.png" />

1.  **Sender** — the address from which you will reply to messages.
2.  **Outgoing mail server**: [smtp.gmail.com](https://smtp.gmail.com).
3.  **SMTP server port**: 465.
4.  **Encryption**: SSL.
5.  **Username** — usually your email address.
6.  **Password** — an app password is required. The steps to create one are described below.
7.  **Timeout** — the interval in seconds between outgoing messages. It helps avoid sending many messages at the same time and reduces the risk of being treated as spam.
8.  **"Check connection"** — click this after entering the settings to verify that they are correct. If you see an error, check the values again.

### Other settings

<img height="506" width="579" src="https://support.swarmica.com/attachments/2/i/2ik9-qxFmqNGO2US_a/gmail-setup-en-12.png" />

1.  **Allow ticket creation** — enable this to create tickets in Swarmica from incoming mail.
2.  **Preserve quoting** — preserve the conversation when forwarding messages. When disabled, the forwarded message contains only the accompanying text; when enabled, it contains the full conversation.
3.  **Allow new users in CC** — allow any email address to be added to the CC field of email tickets. This setting helps protect against spammers who use ticket creation to send mailings.
4.  **Same domain in CC** — allow only addresses from the domain in the ticket creator's email address to be added to CC. This is a simplified protection against the spam scenario described above.
5.  **Use by default** — enable this so replies are always sent from the specified sender address.
6.  **Enabled** — activates the email channel in Swarmica.

After completing and checking the settings, remember to save them.

# Gmail-side settings

1\. Open Gmail, click the gear icon in the upper-right corner, and choose **See all settings**.

<img height="587" width="512" src="https://support.swarmica.com/attachments/n/J/nJGapt9QIRuvyMhT_a/gmail-setup-en-2.png" />

2\. Open the **Forwarding and POP/IMAP** tab. In the **IMAP access** section, make sure that **Enable IMAP** is selected.

![](https://support.swarmica.com/attachments/1/r/1r-ErZ2oZqoiQykt_a/gmail-setup-en-7.png)

Save the changes at the bottom of the page if necessary.

3\. Click your Google account avatar in the upper-right corner and choose **Manage your Google Account**.

<img height="403" width="323" src="https://support.swarmica.com/attachments/t/7/t7aFwtqFwGvm1YQL_a/gmail-setup-en-3.png" />

In the side menu, open **Security** and then **2-Step Verification**. 2-Step Verification must be enabled to connect Gmail to Swarmica.

<img height="381" width="641" src="https://support.swarmica.com/attachments/w/W/wWspkDkh7KxblHgw_a/gmail-setup-en-4.png" />

If 2-Step Verification is disabled, open this setting and enable it. You will need to choose an additional verification method, such as SMS, a phone call, or the Google app.

> If you use Google Workspace, make sure that users are allowed to enable 2-Step Verification. In the Admin console, go to **Security - Overview - 2-Step Verification** and enable **Allow users to turn on 2-Step Verification**.

<br />

4\. Open [https://myaccount.google.com/apppasswords](https://myaccount.google.com/apppasswords) to create an app password. Enter a name, for example, Swarmica, and click **Create**.

<img height="277" width="610" src="https://support.swarmica.com/attachments/O/a/Oa1GndAgMk3ZTvSL_a/gmail-setup-en-6.png" />

Copy the password shown on the page and click **Done**:

<img height="431" width="606" src="https://support.swarmica.com/attachments/z/4/z4Orr0mv5rSK-Dla_a/gmail-setup-en-5.png" />

5\. Return to the Swarmica email settings and paste the copied app password into both password fields:

<img height="248" width="744" src="https://support.swarmica.com/attachments/5/P/5PpeJagVQhNvQP_R_a/gmail-setup-en-11.png" />

Check both connections. If an error occurs, verify the settings again.

Click **Save**. Gmail is connected.