> ## Documentation Index
> Fetch the complete documentation index at: https://docs.recruitier.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Email Integration

> Connect Gmail or Outlook to send professional outreach directly from Recruitier.

## Why Connect Your Email?

Before you can send outreach emails through Recruitier, you need to connect your email account. This is not about Recruitier sending emails on your behalf through some generic relay. When you connect Gmail or Outlook, every email Recruitier sends goes out from **your actual inbox**, using your real email address, your name, and your email signature. Recipients see a normal email from you, and their replies land directly in your inbox.

This matters for recruitment because trust is everything. Prospects and hiring managers need to see a real person behind the message, not a faceless automation tool. Your connected email account is the bridge between Recruitier's outreach tools and authentic, professional communication.

<Tip>
  Emails sent through the official Gmail and Microsoft APIs carry your provider's full deliverability reputation. This means your outreach emails are far less likely to end up in spam compared to emails sent through third-party mass mailing services. This is a significant advantage over competing tools that use their own SMTP servers.
</Tip>

## Supported Email Providers

Recruitier supports the two most widely used professional email platforms.

<CardGroup cols={2}>
  <Card title="Gmail">
    Connect via Google OAuth 2.0. Works with personal Gmail accounts and Google Workspace (business) accounts. Recruitier uses the Gmail API to send emails and retrieve your signature. Requires the `gmail.send`, `gmail.compose`, and `gmail.settings.basic` scopes.
  </Card>

  <Card title="Outlook">
    Connect via Microsoft OAuth using the MSAL (Microsoft Authentication Library). Works with personal Outlook/Hotmail accounts and Microsoft 365 (business) accounts. Recruitier uses the Microsoft Graph API to send emails and retrieve your signature. Requires `User.Read`, `Mail.ReadWrite`, and `Mail.Send` scopes.
  </Card>
</CardGroup>

## Setting Up Your Email Connection

<Steps>
  <Step title="Navigate to Settings">
    Open the Settings page from the main navigation menu. Look for the Email Integration section, which shows your current connection status for both Gmail and Outlook.
  </Step>

  <Step title="Choose Your Provider">
    Click the "Connect Gmail" or "Connect Outlook" button, depending on which email service you use. If your agency uses Google Workspace, choose Gmail. If your agency uses Microsoft 365, choose Outlook.
  </Step>

  <Step title="Authorize Recruitier">
    You will be redirected to Google or Microsoft's login page. Sign in with the email account you want to use for outreach, then review the permissions Recruitier is requesting and click "Allow" or "Accept."

    For Gmail, you will see permissions for sending email, composing drafts, and reading basic settings. For Outlook, you will see permissions for reading your profile, reading and writing mail, and sending mail.
  </Step>

  <Step title="Automatic Signature Import">
    After successful authorization, Recruitier automatically fetches your email signature from your provider. This signature is cleaned (broken images and formatting issues are removed), cached locally, and appended to every outreach email you send. No manual setup is required.
  </Step>

  <Step title="Verify Connection">
    Back in Recruitier, the Settings page will show your connected email address and a green status indicator. You are now ready to send outreach emails.
  </Step>
</Steps>

<Note>
  You can connect both Gmail and Outlook simultaneously. When both are connected, a "Preferred Email Provider" selector appears in the Settings page, letting you choose which account to use for sending outreach emails. Gmail is the default unless you explicitly select Outlook.
</Note>

## What Permissions Does Recruitier Need?

When you connect your email, Recruitier requests a specific set of permissions. Here is what each one does and why it is needed.

### Gmail Permissions

| Permission (OAuth Scope) | Why It Is Needed                                                                                        |
| ------------------------ | ------------------------------------------------------------------------------------------------------- |
| **gmail.send**           | Allows Recruitier to send outreach emails from your Gmail address via the Gmail API.                    |
| **gmail.compose**        | Allows Recruitier to create email drafts in your Gmail account.                                         |
| **gmail.settings.basic** | Allows Recruitier to read your email signature so it can be imported and appended to outreach messages. |

### Outlook Permissions

| Permission (OAuth Scope) | Why It Is Needed                                                                                 |
| ------------------------ | ------------------------------------------------------------------------------------------------ |
| **Mail.Send**            | Allows Recruitier to send outreach emails from your Outlook address via the Microsoft Graph API. |
| **Mail.ReadWrite**       | Allows Recruitier to manage email drafts and read mail settings including your signature.        |
| **User.Read**            | Allows Recruitier to read your basic profile information to identify which account is connected. |

<Info>
  Recruitier does **not** request permission to read your full inbox or access your existing email conversations. The connection is strictly for sending outreach, managing drafts, and importing your signature. Your email privacy is fully maintained.
</Info>

## How Email Sending Works

When you compose and send an outreach email in Recruitier, here is what happens behind the scenes:

1. **You compose the message** in Recruitier's message composer, selecting the recipient, subject line, and body content (optionally using AI-assisted generation).
2. **Your cached email signature** is automatically appended to the message body, separated by a line break. Redundant closings like "Best regards" or "Met vriendelijke groet" are removed from the signature to avoid duplication with the AI-generated message.
3. **Recruitier calls the Gmail API or Microsoft Graph API** to send the email from your connected account.
4. **The email appears in your Sent folder** in Gmail or Outlook, just as if you had sent it manually.
5. **A tracking pixel and link wrapping** are applied to the email (when tracking is enabled), allowing you to monitor opens and clicks.
6. **Replies from the recipient** arrive in your inbox as normal email conversations.
7. **Recruitier tracks the message** with delivery status, open tracking, and click tracking, giving you visibility into engagement.

<Note>
  Because emails are sent through the official provider APIs rather than a third-party SMTP server, your emails benefit from your email provider's established domain reputation. This significantly improves deliverability compared to mass mailing services.
</Note>

## Email Tracking

Recruitier includes comprehensive email tracking capabilities for messages sent through the outreach system. Tracking happens automatically -- you do not need to enable anything.

| Tracking Feature     | How It Works                                                                                                                                                                                                                         |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Open tracking**    | An invisible 1x1 pixel image is embedded in the email. When the recipient's email client loads images, the pixel request is recorded. Open count and the timestamp of the first open are tracked.                                    |
| **Click tracking**   | All links in your message body are wrapped through Recruitier's redirect service. When a recipient clicks a link, the click is recorded before redirecting to the original URL. Click count and the specific URL clicked are logged. |
| **Delivery status**  | After sending, Recruitier monitors for bounces. Messages without a bounce after 24 hours are marked as "delivered."                                                                                                                  |
| **Bounce detection** | Hard and soft bounces are detected through inbox monitoring. The bounce reason is recorded so you know whether to retry or remove the contact.                                                                                       |
| **Reply detection**  | Recruitier monitors for replies to your outreach emails and updates the message status to "replied" with a timestamp.                                                                                                                |

<Warning>
  Open tracking relies on the recipient's email client loading images. Many corporate email clients and privacy-focused clients block remote images by default. This means open tracking will undercount actual opens. Do not rely solely on open rates -- reply rates and click rates are more reliable engagement indicators.
</Warning>

## Checking Connection Status

You can verify your email connection status at any time.

1. Go to **Settings** from the main navigation.
2. In the Email Integration section, look for:
   * **Connected email address** -- the email associated with your account.
   * **Provider** -- Gmail or Outlook.
   * **Status indicator** -- green for active, red if the connection has expired or been revoked.

If both Gmail and Outlook are connected, Recruitier uses your preferred email provider setting (configurable in Settings) to determine which account sends emails. Gmail is the default unless you explicitly select Outlook.

## Disconnecting Your Email

If you need to switch email providers or revoke Recruitier's access:

<Steps>
  <Step title="Open Settings">
    Navigate to the Settings page.
  </Step>

  <Step title="Click Disconnect">
    In the Email Integration section, click "Disconnect" next to your connected provider. This immediately removes Recruitier's access tokens and cached signature.
  </Step>

  <Step title="Revoke in Provider (Optional)">
    For complete removal, you can also revoke Recruitier's access directly in your Google Account settings (Security > Third-party apps) or Microsoft Account settings (Apps and services).
  </Step>
</Steps>

<Warning>
  Disconnecting your email does not delete previously sent messages or their tracking data. It only prevents Recruitier from sending new emails through that account. Any outreach flows with pending email steps will need a reconnected email account to proceed.
</Warning>

## Troubleshooting Common Issues

<Accordion title="Authentication expired error">
  OAuth tokens have a limited lifetime. If your connection shows as expired:

  1. Go to Settings and click "Reconnect" for your email provider.
  2. You will go through the OAuth flow again. This refreshes the authentication tokens.
  3. Your signature will be re-imported automatically.

  This is normal and happens periodically. Google tokens typically last longer than Microsoft tokens, but both expire eventually.
</Accordion>

<Accordion title="Emails not appearing in Sent folder">
  This typically happens when the OAuth token has expired silently. Reconnect your email to refresh the authentication, then retry the send. Check the message status in Recruitier -- if it shows "Failed," the token expiration is the most likely cause.
</Accordion>

<Accordion title="Signature not showing correctly">
  If your imported signature looks different from what you see in Gmail or Outlook:

  1. Go to Settings and use the "Refresh Signature" option to re-import your signature from the provider.
  2. Be aware that Recruitier's cleaning process removes broken images (localhost URLs, empty src attributes, oversized images) and redundant closing phrases. This is intentional to ensure signatures render correctly across all email clients.
  3. If the issue persists, consider simplifying your signature in Gmail or Outlook, then refreshing it in Recruitier.
</Accordion>

<Accordion title="Permission denied during setup">
  If Google or Microsoft rejects the authorization:

  * Ensure your organization's admin has not blocked third-party app access.
  * For Google Workspace accounts, the admin may need to allowlist Recruitier in the Admin Console under Security > API Controls.
  * For Microsoft 365 accounts, the admin may need to grant consent for the application in the Azure AD portal.
  * Some organizations require admin consent for applications that request `Mail.Send` scope. Contact your IT administrator.
</Accordion>

<Accordion title="Cannot send emails after connecting">
  If your connection shows as active but emails fail to send:

  1. Check that your OAuth tokens have not expired -- try disconnecting and reconnecting.
  2. Verify that the email address you connected is still active and not suspended.
  3. For Google Workspace accounts, ensure that the Gmail API is enabled in the Google Admin Console.
  4. For Microsoft 365, ensure that your account has a valid Exchange Online license.
</Accordion>

<Tip>
  We recommend connecting the email account you use for day-to-day recruitment communication. This keeps your outreach consistent with your normal email activity and ensures replies integrate naturally into your existing workflow.
</Tip>

## Advanced

### Token Security and Storage

Recruitier takes token security seriously. All OAuth access tokens and refresh tokens are encrypted before storage using **AES-GCM** (Advanced Encryption Standard in Galois/Counter Mode). This is an authenticated encryption scheme that provides both confidentiality and integrity. Even if the database were compromised, the tokens would be unreadable without the encryption key, which is stored separately from the database.

The token lifecycle works as follows:

1. During OAuth, the provider returns an access token and a refresh token.
2. Both tokens are encrypted with AES-GCM before being stored in the database.
3. When sending an email, the access token is decrypted and used for the API call.
4. If the access token has expired, the refresh token is decrypted and used to obtain a new access token from the provider.
5. The new access token is encrypted and stored, replacing the expired one.

### How Email Tracking Works Technically

**Open tracking** uses an invisible tracking pixel -- a 1x1 pixel GIF image embedded in the email HTML. The pixel is styled to be completely invisible: `width=1, height=1, border=0, visibility=hidden, opacity=0`. When the recipient's email client loads images, it makes an HTTP request to Recruitier's tracking endpoint at `/t/o/{tracking_id}`, where `tracking_id` is a unique UUID assigned to each message. This request increments the `open_count` on the message record and sets `first_opened_at` if it is the first open.

**Click tracking** works by wrapping all links in the message body. Instead of linking directly to `https://example.com`, the link points to `/t/c/{tracking_id}?url=https://example.com`. When clicked, Recruitier records the click (incrementing `click_count` and storing the `link_url`) and then redirects the user to the original URL.

**Delivery monitoring** uses a CronJob that periodically checks for bounces. Messages that have been sent for more than 24 hours without a bounce are marked as "delivered." Bounced messages have their `bounced_at` timestamp and `bounce_reason` recorded.

<Info>
  Links in your email signature are **not** wrapped for click tracking. Only links you explicitly include in the message body participate in click tracking. This prevents your LinkedIn profile URL or website link in the signature from inflating your click metrics.
</Info>

### How Gmail and Outlook Integrations Differ

While both integrations achieve the same result (sending emails from your account), there are subtle technical differences:

| Aspect                  | Gmail                                                 | Outlook                                     |
| ----------------------- | ----------------------------------------------------- | ------------------------------------------- |
| **OAuth Library**       | Google OAuth2 Client                                  | MSAL (Microsoft Authentication Library)     |
| **API for Sending**     | Gmail API (`users.messages.send`)                     | Microsoft Graph API (`/me/sendMail`)        |
| **Signature Retrieval** | Gmail Settings API (`users.settings.sendAs`)          | Microsoft Graph API (`/me/mailboxSettings`) |
| **Token Refresh**       | Automatic via Google client library                   | Automatic via MSAL token cache              |
| **Scopes**              | `gmail.send`, `gmail.compose`, `gmail.settings.basic` | `User.Read`, `Mail.ReadWrite`, `Mail.Send`  |

### Connection and Signature Caching Strategy

Your email signature is cached in the database on your user record:

* Gmail signatures are stored in the `gmail_signature_html` field.
* Outlook signatures are stored in the `microsoft_signature_html` field.

During the cleaning process, the following transformations are applied:

* **Broken images are removed**: Images with `localhost` URLs, empty `src` attributes, or excessively large dimensions are stripped out.
* **Redundant closings are removed**: Common closing phrases like "Best regards," "Met vriendelijke groet," "Kind regards," etc. are removed to avoid duplication with the AI-generated message (which includes its own closing).
* **The signature is separated** from the message body with a `<br><br>` separator.

This ensures that your signature renders consistently across email clients without broken images or duplicate closings.

### Handling Dual Connections

When both Gmail and Outlook are connected, a "Preferred Email Provider" card appears in the Settings page with radio buttons to choose between Gmail and Outlook. Gmail is selected by default. This means:

* You can switch your active sending provider at any time without disconnecting and reconnecting.
* Both signatures are cached independently, so switching providers does not lose either signature.
* Tracking data is not affected by switching providers -- it is tied to the message, not the provider.
* The preference is stored on your user profile and persists across sessions.

### Rate Limits and Fair Use

Both Gmail and Outlook APIs have rate limits that Recruitier respects:

* **Gmail**: Up to 500 emails per day for regular accounts, higher limits for Google Workspace.
* **Outlook/Microsoft 365**: Varies by plan, typically 10,000 recipients per day for business accounts.

Recruitier does not batch-send emails. Each outreach message is sent individually through the API, which keeps you well within rate limits for normal recruitment outreach volumes. If you are doing high-volume outreach, be mindful of your provider's daily sending limits.

## Related

<CardGroup cols={2}>
  <Card title="Email Signatures" href="/outreach/email-signatures">
    Learn more about managing and customizing your email signature.
  </Card>

  <Card title="Message Composer" href="/outreach/message-composer">
    Start composing and sending outreach messages.
  </Card>

  <Card title="Creating Flows" href="/outreach/creating-flows">
    Build multi-step outreach sequences with email steps.
  </Card>

  <Card title="Outreach Overview" href="/outreach/overview">
    Return to the outreach overview for a complete picture.
  </Card>
</CardGroup>
