Email Integration
Set up automated emails for user authentication, notifications, and custom workflows in your Cocobase project.All email configurations are managed through the Cocobase Dashboard. No code required for setup.
Overview
Cocobase email features:- Transactional emails - Welcome, verification, password reset
- Custom templates - Design emails with HTML/CSS
- Template variables - Personalize with user data
- Email triggers - Automated sends based on events
- SMTP configuration - Use your own email provider
- Email analytics - Track opens, clicks, deliveries
Default Email Templates
Cocobase provides pre-built templates for common scenarios:1. Welcome Email
Sent when a new user registers:- Triggered automatically on registration
- Includes: username, account details, getting started tips
- Can be customized in dashboard
2. Email Verification
Sent to verify user’s email address:- Contains verification link
- Link expires after 24 hours
- Automatic retry if not verified
3. Password Reset
Sent when user requests password reset:- Contains secure reset link
- Link expires after 1 hour
- One-time use only
4. Password Changed
Confirmation when password is successfully changed:- Includes timestamp and location
- Security alert
5. Two-Factor Authentication
2FA code delivery:- 6-digit verification code
- Expires after 10 minutes
Email Configuration
Step 1: Access Email Settings
- Log in to Cocobase Dashboard
- Select your project
- Navigate to Settings → Email Configuration
- View email provider and templates
Step 2: Choose Email Provider
Cocobase supports multiple email providers:Option 1: Cocobase Email (Default)
- Free tier: 100 emails/day
- Pro plan: 10,000 emails/day
- No configuration needed
- Sent from:
[email protected]
Option 2: Custom SMTP
Use your own email service:- Click Custom SMTP
-
Enter SMTP credentials:
- Host: smtp.yourprovider.com
- Port: 587 (or 465 for SSL)
- Username: Your email or API key
- Password: Your password or API secret
- From Email: [email protected]
- From Name: Your App Name
- Click Test Connection
- Save settings
- SendGrid
- Mailgun
- Amazon SES
- SMTP2GO
- Gmail (for testing only)
- Any SMTP server
Option 3: Email API Integration
Integrate with email service APIs:- Select API Integration
-
Choose provider:
- SendGrid
- Mailgun
- Postmark
- Amazon SES
- Enter API credentials
- Configure sending domain
- Test and save
Customizing Email Templates
Step 1: Select Template
- Email Configuration → Templates
- Choose template to customize:
- Welcome Email
- Email Verification
- Password Reset
- Custom Template
Step 2: Edit Template
Subject Line:Step 3: Available Variables
Use these variables in your templates: User Variables:{user_name}- User’s full name{user_email}- User’s email address{user_id}- User’s unique ID{user_username}- Username{user_role}- User’s role- Any custom user field:
{user.custom_field}
{app_name}- Your project name{app_url}- Your application URL{support_email}- Support email address
{verification_link}- Email verification URL{reset_link}- Password reset URL{verification_code}- 2FA or verification code{magic_link}- Passwordless login link
{current_date}- Current date{current_time}- Current time{current_year}- Current year
Step 4: Preview & Test
- Click Preview to see rendered email
- Send test email to yourself
- Check inbox and spam folder
- Verify links work correctly
- Test on mobile and desktop
- Save template when satisfied
Custom Email Triggers
Send emails based on custom events and conditions.Step 1: Create Trigger
- Email Configuration → Triggers
- Click Create Trigger
- Configure trigger:
Step 2: Configure Email
Recipient:{document.customer_email}
Subject: Order # Confirmed
Template: Select or create custom template
Template Variables:
Step 3: Test Trigger
- Click Test Trigger
- Provide sample document data
- Check email delivery
- Verify template rendering
- Activate trigger
Email Examples
Welcome Email
Password Reset
Order Confirmation
Weekly Digest
Email Best Practices
Keep It Simple
Keep It Simple
- Use clean, minimal design
- Focus on one call-to-action
- Avoid large images (slow loading)
- Test on mobile devices
- Use system fonts for better rendering
Personalization
Personalization
Clear Call-to-Action
Clear Call-to-Action
Mobile-Responsive
Mobile-Responsive
Test Before Sending
Test Before Sending
- Send test emails to yourself
- Check on different email clients:
- Gmail
- Outlook
- Apple Mail
- Mobile apps
- Verify all links work
- Check spam score
- Review on mobile
Avoid Spam Triggers
Avoid Spam Triggers
Don’t use:
- ALL CAPS IN SUBJECT LINES
- Excessive exclamation marks!!!
- Spam trigger words (FREE, WINNER, ACT NOW)
- Suspicious links
- Large attachments
- Use clear subject lines
- Include unsubscribe link
- Authenticate your domain
- Maintain clean email list
Programmatic Email Sending
While most emails are triggered automatically, you can also send custom emails from your code.- JavaScript
- TypeScript
- Dart
- Python
Email Analytics
Track email performance in the dashboard.Available Metrics
-
Delivery Rate
- Total emails sent
- Successfully delivered
- Bounced emails
- Failed deliveries
-
Engagement
- Open rate
- Click-through rate
- Time to first open
- Device/client breakdown
-
Issues
- Bounce rate (hard/soft)
- Spam complaints
- Unsubscribes
- Blocked emails
Viewing Analytics
- Dashboard → Email → Analytics
- Select date range
- Filter by template
- View detailed reports
- Export data (CSV)
Improving Deliverability
If open rates are low:- Improve subject lines
- Send at better times
- Segment your audience
- A/B test templates
- Clean email list
- Remove invalid addresses
- Verify email domains
- Check SMTP configuration
- Add unsubscribe link
- Authenticate domain (SPF/DKIM)
- Reduce send frequency
- Improve email content
Domain Authentication
Improve email deliverability by authenticating your domain.Step 1: Add DNS Records
- Dashboard → Email → Domain Authentication
- Click Authenticate Domain
- Enter your domain:
yourdomain.com - Copy provided DNS records:
Step 2: Add Records to DNS Provider
- Log in to your DNS provider (Cloudflare, Namecheap, etc.)
- Add the records exactly as shown
- Wait for DNS propagation (up to 48 hours)
Step 3: Verify
- Return to Cocobase dashboard
- Click Verify Domain
- Wait for confirmation
- Start sending authenticated emails
Troubleshooting
Emails Not Being Received
Check:- Spam/junk folder
- Email configuration in dashboard
- SMTP credentials are correct
- Email provider status
- Recipient email is valid
Links Not Working
Solutions:- Verify variable syntax:
{verification_link} - Check template preview
- Test with real data
- Ensure app URL is configured correctly
Template Not Rendering
Common Issues:- Invalid HTML syntax
- Missing closing tags
- Undefined variables
- CSS compatibility issues
- Use HTML validator
- Test template preview
- Check all variables are defined
- Use inline CSS
