Email Campaigns
Msghub includes a full-featured email marketing platform with drag-and-drop builder, open tracking, click tracking, bounce handling, and segmentation. Manage email alongside SMS, WhatsApp, and other channels in the same dashboard.
Email Setup
Connect Your Email Provider
Msghub supports three email providers:
Option 1: SMTP
Use your own SMTP server (Gmail, Outlook, custom server).
- Go to Settings → Channels → Email
- Select SMTP
- Enter:
- SMTP Host — e.g., smtp.gmail.com
- SMTP Port — Usually 587 (TLS) or 465 (SSL)
- Username — Your email address
- Password — Your password or app password
- From Address — Sender email address
- From Name — Sender name
- Click Test Connection
- Click Save
Option 2: SendGrid
- Go to Settings → Channels → Email
- Select SendGrid
- Paste your SendGrid API key
- Click Test Connection
- Click Save
Option 3: Mailgun
- Go to Settings → Channels → Email
- Select Mailgun
- Enter:
- API Key — Your Mailgun API key
- Domain — Your Mailgun domain
- Click Test Connection
- Click Save
Sending Email
Via Dashboard
- Go to Campaigns → New Campaign
- Select Email as the channel
- Choose your contacts or segments
- Click Design Email
- Use the drag-and-drop builder to create your email
- Click Send Now or Schedule
Via API
curl -X POST \
https://your-msghub.com/api/v1/messages/send \
-H "X-API-Key: mk_live_..." \
-H "Content-Type: application/json" \
-d '{
"channel": "email",
"to": "rahul@example.com",
"subject": "Your order has shipped!",
"body": "<h1>Order Confirmation</h1><p>Your order ORD-4821 has shipped.</p>",
"htmlBody": true
}'
Email Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
channel | string | Yes | Must be "email" |
to | string | Yes | Recipient email address |
subject | string | Yes | Email subject line |
body | string | Yes | Email body (HTML or plain text) |
htmlBody | boolean | No | Set to true if body is HTML |
from | string | No | Sender email (uses default if not specified) |
replyTo | string | No | Reply-to email address |
cc | array | No | CC recipients |
bcc | array | No | BCC recipients |
attachments | array | No | File attachments |
Drag-and-Drop Email Builder
The email builder lets you create professional emails without coding.
Components
- Text — Paragraphs, headings, lists
- Image — Single or multiple images
- Button — Call-to-action buttons
- Divider — Horizontal lines
- Spacer — Vertical spacing
- Social — Social media icons
- HTML — Custom HTML blocks
Creating an Email
- Click Add Block
- Choose a component (Text, Image, Button, etc.)
- Edit the content
- Drag to reorder blocks
- Preview on desktop and mobile
- Click Save
Email Template Variables
Use variables to personalize emails:
<h1>Hi {{firstName}},</h1>
<p>Your order {{orderId}} has shipped.</p>
<p>Track it here: {{trackingUrl}}</p>
When sending, provide the variables:
curl -X POST \
https://your-msghub.com/api/v1/messages/send \
-H "X-API-Key: mk_live_..." \
-d '{
"channel": "email",
"to": "rahul@example.com",
"templateId": "order_confirmation",
"parameters": {
"firstName": "Rahul",
"orderId": "ORD-4821",
"trackingUrl": "https://track.example.com/ORD-4821"
}
}'
Open Tracking
Msghub tracks when emails are opened using a pixel-level tracking method.
How It Works
- Msghub adds a 1x1 pixel image to every email
- When the recipient opens the email, the pixel loads
- Msghub records the open event
Receiving Open Events
{
"event": "message.opened",
"messageId": "msg_abc123",
"channel": "email",
"from": "rahul@example.com",
"openedAt": "2024-04-08T10:30:05Z"
}
Open Analytics
View open rates in the dashboard:
- Go to Campaigns → [Campaign Name]
- Scroll to Analytics
- See:
- Sent — Number of emails sent
- Delivered — Number delivered
- Opened — Number opened
- Open Rate — Percentage opened
Click Tracking
Msghub tracks when recipients click links in your emails.
How It Works
- Msghub wraps all links with a tracking URL
- When the recipient clicks a link, Msghub records the click
- The recipient is redirected to the original URL
Receiving Click Events
{
"event": "message.clicked",
"messageId": "msg_abc123",
"channel": "email",
"from": "rahul@example.com",
"url": "https://example.com/product",
"clickedAt": "2024-04-08T10:30:05Z"
}
Click Analytics
View click rates in the dashboard:
- Go to Campaigns → [Campaign Name]
- Scroll to Analytics
- See:
- Clicked — Number of clicks
- Click Rate — Percentage clicked
- Top Links — Most clicked links
Bounce Handling
Msghub automatically handles bounced emails.
Bounce Types
- Hard Bounce — Invalid email address, domain doesn't exist
- Soft Bounce — Mailbox full, server temporarily unavailable
- Complaint — Recipient marked as spam
Bounce Events
{
"event": "message.bounced",
"messageId": "msg_abc123",
"channel": "email",
"to": "invalid@example.com",
"bounceType": "hard",
"reason": "Invalid email address",
"bouncedAt": "2024-04-08T10:30:05Z"
}
Bounce Management
Msghub automatically:
- Removes hard bounces from your contact list
- Retries soft bounces
- Unsubscribes complaints
You can also manually manage bounces:
curl -X POST \
https://your-msghub.com/api/v1/contacts/contact_123/bounce \
-H "X-API-Key: mk_live_..." \
-d '{
"bounceType": "hard",
"reason": "Invalid email address"
}'
Segmentation
Send targeted emails to specific segments of your audience.
Create a Segment
- Go to Contacts → Segments
- Click Create Segment
- Add conditions:
- Tag — Contacts with specific tags
- Property — Contacts with specific properties
- Behavior — Contacts who performed specific actions
- Click Save
Send to a Segment
curl -X POST \
https://your-msghub.com/api/v1/campaigns \
-H "X-API-Key: mk_live_..." \
-d '{
"name": "VIP Newsletter",
"channel": "email",
"subject": "Exclusive offer for VIP members",
"body": "<h1>VIP Exclusive</h1><p>50% off everything!</p>",
"recipients": {
"segment": "vip_customers"
}
}'
Unsubscribe Management
Msghub includes one-click unsubscribe links in all emails.
Unsubscribe Link
Msghub automatically adds:
<a href="https://your-msghub.com/unsubscribe/{{messageId}}">Unsubscribe</a>
When a recipient clicks unsubscribe:
- They're removed from your email list
- Msghub records the unsubscribe event
- Future emails to that address are blocked
Unsubscribe Events
{
"event": "message.unsubscribed",
"messageId": "msg_abc123",
"channel": "email",
"from": "rahul@example.com",
"unsubscribedAt": "2024-04-08T10:30:05Z"
}
Email Verification
Verify email addresses before sending to improve deliverability.
Verify a Single Email
curl -X POST \
https://your-msghub.com/api/v1/emails/verify \
-H "X-API-Key: mk_live_..." \
-d '{
"email": "rahul@example.com"
}'
Response:
{
"email": "rahul@example.com",
"valid": true,
"deliverable": true,
"riskLevel": "low"
}
Verify Bulk Emails
curl -X POST \
https://your-msghub.com/api/v1/emails/verify-bulk \
-H "X-API-Key: mk_live_..." \
-d '{
"emails": [
"rahul@example.com",
"priya@example.com",
"invalid@example.com"
]
}'
Email Campaigns
Send emails to multiple contacts using campaigns.
Create a Campaign
curl -X POST \
https://your-msghub.com/api/v1/campaigns \
-H "X-API-Key: mk_live_..." \
-d '{
"name": "Summer Collection Launch",
"channel": "email",
"subject": "New summer collection is here!",
"body": "<h1>Summer Collection</h1><p>Check out our new summer styles.</p>",
"recipients": {
"segment": "newsletter_subscribers"
},
"sendAt": "2024-04-08T18:00:00Z"
}'
Monitor Campaign
curl -X GET \
https://your-msghub.com/api/v1/campaigns/camp_xyz789 \
-H "X-API-Key: mk_live_..."
Response includes:
- Sent — Number of emails sent
- Delivered — Number delivered
- Opened — Number opened
- Clicked — Number clicked
- Bounced — Number bounced
- Unsubscribed — Number unsubscribed
Best Practices
Subject Lines
- Keep it short — Under 50 characters
- Be specific — "Your order has shipped" not "Update"
- Personalize — Use customer name
- Avoid spam words — "Free", "Limited time", "Act now"
Email Content
- Mobile-first — Design for small screens
- Clear CTA — One main call-to-action
- Scannable — Use headings, lists, short paragraphs
- Images — Use high-quality images with alt text
Timing
- Send during business hours — 9 AM - 5 PM
- Avoid weekends — Unless it's time-sensitive
- Test send times — A/B test to find best time
- Respect time zones — Schedule for recipient's local time
Compliance
- Get consent — Always ask before adding to list
- Include unsubscribe — Msghub adds it automatically
- Honor opt-outs — Remove unsubscribed addresses
- Keep records — Log all consent and opt-outs
Troubleshooting
Emails not delivering
- Check email address — Is it valid?
- Check sender — Is the from address verified?
- Check spam folder — Is the email in spam?
- Check provider — Is your email provider working?
Low open rate
- Check subject line — Is it compelling?
- Check timing — Are you sending at the right time?
- Check content — Is the email relevant?
- Check list quality — Are the email addresses valid?
High bounce rate
- Verify emails — Use email verification before sending
- Clean list — Remove invalid addresses
- Check sender — Is the from address verified?
- Check content — Is the email triggering spam filters?