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¶
- Go to https://signup.sendgrid.com/
- Sign up for a free account (100 emails/day free)
- Verify your email address
- Complete the account setup
Step 2: Create API Key¶
- Log in to SendGrid Dashboard: https://app.sendgrid.com/
- Go to Settings → API Keys (left sidebar)
- Click "Create API Key"
- Name it:
Render Email Service - Select permissions: "Full Access" (or just "Mail Send" if you prefer)
- Click "Create & View"
- Copy the API key immediately (you won't see it again!)
- It looks like:
SG.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Step 3: Verify Sender Email¶
- In SendGrid Dashboard, go to Settings → Sender Authentication
- Click "Verify a Single Sender"
- Fill in the form:
- From Email Address:
support@pcbgenerator.com - From Name:
MagicON AI - Reply To:
support@pcbgenerator.com - Company Address: (your address)
- Website URL:
https://pcbgenerator.com - Click "Create"
- Check your email (
support@pcbgenerator.com) and click the verification link - 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:
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:
- Sign up: https://signup.mailgun.com/
- Verify your domain or use their sandbox domain
- Get SMTP credentials from Dashboard → Sending → SMTP credentials
- Update Render:
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!