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

# SendGrid Integration

> Send emails at scale with SendGrid

## What is SendGrid?

SendGrid is one of the most popular email services, trusted by companies worldwide. It's perfect for sending lots of emails reliably - from welcome emails to marketing campaigns.

**Perfect for:**

* High-volume email sending
* Transactional emails (receipts, resets, etc.)
* Marketing campaigns
* Email analytics and tracking

## What You'll Need

<Steps>
  <Step title="SendGrid Account">
    Sign up at [sendgrid.com](https://sendgrid.com) - free plan available!
  </Step>

  <Step title="Verify Sender">
    Verify your email or domain
  </Step>

  <Step title="API Key">
    Create an API key
  </Step>
</Steps>

## Step 1: Get Your SendGrid API Key

### Create Account

1. Go to [signup.sendgrid.com](https://signup.sendgrid.com)
2. Sign up for free account
3. Verify your email

**Free Plan Includes:**

* 100 emails per day, forever!
* Full API access
* Email analytics

### Verify Your Sender

<Note>
  **Quick Start:** Verify a single email (easiest)

  **Production:** Verify your domain (best for serious apps)
</Note>

**Option 1: Single Sender (Quick)**

1. In Dashboard → **Settings** → **Sender Authentication**
2. Click **Verify a Single Sender**
3. Fill in:
   * Your name
   * Your email (like [noreply@yoursite.com](mailto:noreply@yoursite.com))
   * Company info
4. Check your email and click the verification link
5. Done! ✓

**Option 2: Domain (Production)**

1. **Settings** → **Sender Authentication**
2. **Authenticate Your Domain**
3. Enter your domain
4. Add DNS records (SendGrid shows you what to add)
5. Click **Verify**

### Create API Key

1. Go to **Settings** → **API Keys**
2. Click **Create API Key**
3. Name it (like "My App")
4. Choose **Full Access** (or **Mail Send** if you only send emails)
5. Click **Create & View**
6. **Copy it immediately!** (Can't see it again)

<Warning>
  \*\*Save now - \*\*The API key is shown only once. Store it safely.
</Warning>

## Step 2: Tell the Agent What You Want

Describe the emails you need:

### Example 1: Basic Transactional Emails

```
I need SendGrid for sending emails.

SendGrid API key: [paste your key]
Send from: noreply@mysite.com

Emails I need:
- Welcome email when users sign up
- Password reset emails
- Order confirmations

Make them professional and clean.

Please set this up.
```

### Example 2: Beautiful Email Templates

```
I need SendGrid with nice-looking email templates.

SendGrid API key: [paste your key]
Send from: hello@mycompany.com

Templates needed:
1. Welcome email (with user's name and "Get Started" button)
2. Order confirmation (with order details)
3. Monthly newsletter template

Make them:
- Mobile-friendly
- On-brand (blue #3B82F6)
- Professional

Please build this.
```

### Example 3: E-commerce Emails

```
I need complete e-commerce email flow.

SendGrid API key: [paste your key]

Emails:
- Order placed (with order summary)
- Payment received (with receipt)
- Shipping update (with tracking link)
- Delivered confirmation

All should include:
- Customer name
- Order number
- Items purchased
- Totals

Please set this up.
```

<Tip>
  \*\*That's it - \*\*The agent handles all the technical setup.
</Tip>

## Step 3: Test Your Emails

After setup:

<Steps>
  <Step title="Click Preview">
    In Emergent, click **Preview**
  </Step>

  <Step title="Trigger Email">
    Do something that sends email (like sign up)
  </Step>

  <Step title="Check Inbox">
    Look for the email
  </Step>

  <Step title="Test on Mobile">
    Forward to your phone and check
  </Step>

  <Step title="Click All Links">
    Make sure buttons work
  </Step>

  <Step title="Check SendGrid Dashboard">
    View email in SendGrid Activity Feed
  </Step>
</Steps>

## Common Questions

<AccordionGroup>
  <Accordion title="How much does SendGrid cost?">
    **Free:** 100 emails/day forever

    **Paid plans:**

    * Essentials: \$19.95/month (50,000 emails)
    * Pro: \$89.95/month (1.5M emails)
    * More: Custom pricing

    Free plan is great for testing!
  </Accordion>

  <Accordion title="Emails going to spam?">
    Tell the agent:

    ```
    My emails are landing in spam. Can you:
    1. Make sure I'm using verified domain (not single sender)
    2. Add unsubscribe link
    3. Check email content for spam triggers
    4. Improve email reputation
    ```
  </Accordion>

  <Accordion title="Can I track opens and clicks?">
    Yes! Tell the agent:

    ```
    I want to track:
    - When emails are opened
    - When links are clicked
    - Delivery status

    Please add email tracking.
    ```
  </Accordion>

  <Accordion title="Can I use fancy email designs?">
    Yes! You can create templates in SendGrid dashboard, or tell the agent:

    ```
    Create beautiful email templates with:
    - My logo
    - Brand colors
    - Nice buttons
    - Images
    ```
  </Accordion>
</AccordionGroup>

## Something Not Working?

### Emails Not Sending

**Tell the agent:**

```
Emails aren't sending. Error message:
[paste error]

Can you fix the SendGrid integration?
```

### Wrong Sender Address

**Tell the agent:**

```
Emails showing wrong sender.
Should be: support@mycompany.com
Can you update it?
```

### Hitting Daily Limit

**Tell the agent:**

```
I'm hitting the 100 emails/day limit.
Can you add logic to:
1. Queue emails if limit reached
2. Warn me when close to limit
```

## Real Examples

### Example 1: SaaS Application

```
I need SendGrid for my SaaS app:

Welcome series:
- Day 1: Welcome + onboarding
- Day 3: Feature highlights
- Day 7: Check-in

Transactional:
- Password resets
- Billing receipts
- Usage alerts

SendGrid API key: [paste key]
From: hello@mysaas.com

Please build this.
```

### Example 2: Marketplace

```
E-commerce marketplace emails:

For Buyers:
- Order confirmation
- Shipping updates
- Delivery confirmation
- Review request

For Sellers:
- New order alert
- Payout notifications

SendGrid API key: [paste key]

Please set all these up.
```

## Advanced Features

Once basic emails work, you can ask for:

### Email Templates

```
Create email templates in SendGrid dashboard that I can reuse.
Show me how to use them.
```

### Scheduled Emails

```
I want to schedule emails:
- Send welcome email 1 hour after signup
- Send reminder 24 hours later
```

### Email Lists

```
I need to send newsletters to my user list.
Set up email list management.
```

## Quick Checklist

Before going live:

* Sender email/domain verified
* Tested all email types
* Emails not going to spam
* Mobile-friendly design
* All links work correctly
* Unsubscribe link included (required!)
* Checked SendGrid Activity Feed

## Remember

**Free tier is generous** - 100 emails/day

**Verify your domain for production** - Better deliverability

**Test thoroughly** - Check spam folder too

**Track your emails** - Use SendGrid analytics

**Add unsubscribe links** - Required by law

<Info>
  Stuck? Tell the agent: "I need help with SendGrid" and explain what's not working.
</Info>
