Skip to content

SendGrid Setup for Render (Free Email Service)

Why SendGrid?

Render's free tier blocks all outbound SMTP ports (25, 465, 587). SendGrid uses their API which works perfectly on Render's free tier.

Step 1: Create SendGrid Account

  1. Go to https://signup.sendgrid.com/
  2. Sign up for a free account (100 emails/day free)
  3. Verify your email address
  4. Complete the account setup

Step 2: Create API Key

  1. Log in to SendGrid Dashboard: https://app.sendgrid.com/
  2. Go to SettingsAPI Keys (left sidebar)
  3. Click "Create API Key"
  4. Name it: Render Email Service
  5. Select permissions: "Full Access" (or just "Mail Send" if you prefer)
  6. Click "Create & View"
  7. Copy the API key immediately (you won't see it again!)
  8. It looks like: SG.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Step 3: Verify Sender Email

  1. In SendGrid Dashboard, go to SettingsSender Authentication
  2. Click "Verify a Single Sender"
  3. Fill in the form:
  4. From Email Address: support@pcbgenerator.com
  5. From Name: MagicON AI
  6. Reply To: support@pcbgenerator.com
  7. Company Address: (your address)
  8. Website URL: https://pcbgenerator.com
  9. Click "Create"
  10. Check your email (support@pcbgenerator.com) and click the verification link
  11. Note: If you have email forwarding set up in Hostinger, the verification email will be forwarded to your Gmail

Step 4: Update Render Environment Variables

Go to Render Dashboard → Your Backend Service → Environment:

Update these variables:

SMTP_HOST=smtp.sendgrid.net
SMTP_PORT=587
SMTP_USER=apikey
SMTP_PASSWORD=SG.your-actual-api-key-here
SMTP_FROM_EMAIL=support@pcbgenerator.com
ADMIN_EMAIL=magiccadai@gmail.com
EMAIL_NOTIFICATIONS_ENABLED=true

Important: - SMTP_USER must be exactly: apikey (not your email) - SMTP_PASSWORD is your SendGrid API key (starts with SG.) - SMTP_FROM_EMAIL must be the verified sender email (support@pcbgenerator.com) - ADMIN_EMAIL is where you receive notifications (can be your Gmail if forwarding is set up)

Step 5: Test

After updating environment variables, Render will auto-redeploy. Then test:

GET https://ai-assisted-pcb-stackup-generator.onrender.com/api/webhooks/test/email-status

Should show:

{
  "status": "ok",
  "email_service": {
    "enabled": true,
    "smtp_configured": true,
    "admin_email_set": true
  }
}

Then test sending:

POST https://ai-assisted-pcb-stackup-generator.onrender.com/api/webhooks/test/send-welcome-email
Body: {"email": "magiccadai@gmail.com"}

Alternative: Mailgun (5000 emails/month free)

If you prefer Mailgun:

  1. Sign up: https://signup.mailgun.com/
  2. Verify your domain or use their sandbox domain
  3. Get SMTP credentials from Dashboard → Sending → SMTP credentials
  4. Update Render:
    SMTP_HOST=smtp.mailgun.org
    SMTP_PORT=587
    SMTP_USER=postmaster@your-domain.mailgun.org
    SMTP_PASSWORD=your-mailgun-password
    

Why This Works

  • SendGrid/Mailgun use their own infrastructure
  • They accept connections from Render's network
  • No port blocking issues
  • More reliable for cloud hosting
  • Better deliverability

Free Tier Limits

  • SendGrid: 100 emails/day (forever free)
  • Mailgun: 5,000 emails/month (first 3 months), then 1,000/month

For your use case (welcome emails + admin notifications), SendGrid's 100/day is plenty!