Skip to main content

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).

  1. Go to Settings → Channels → Email
  2. Select SMTP
  3. 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
  4. Click Test Connection
  5. Click Save

Option 2: SendGrid

  1. Go to Settings → Channels → Email
  2. Select SendGrid
  3. Paste your SendGrid API key
  4. Click Test Connection
  5. Click Save

Option 3: Mailgun

  1. Go to Settings → Channels → Email
  2. Select Mailgun
  3. Enter:
    • API Key — Your Mailgun API key
    • Domain — Your Mailgun domain
  4. Click Test Connection
  5. Click Save

Sending Email

Via Dashboard

  1. Go to Campaigns → New Campaign
  2. Select Email as the channel
  3. Choose your contacts or segments
  4. Click Design Email
  5. Use the drag-and-drop builder to create your email
  6. 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

ParameterTypeRequiredDescription
channelstringYesMust be "email"
tostringYesRecipient email address
subjectstringYesEmail subject line
bodystringYesEmail body (HTML or plain text)
htmlBodybooleanNoSet to true if body is HTML
fromstringNoSender email (uses default if not specified)
replyTostringNoReply-to email address
ccarrayNoCC recipients
bccarrayNoBCC recipients
attachmentsarrayNoFile 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

  1. Click Add Block
  2. Choose a component (Text, Image, Button, etc.)
  3. Edit the content
  4. Drag to reorder blocks
  5. Preview on desktop and mobile
  6. 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

  1. Msghub adds a 1x1 pixel image to every email
  2. When the recipient opens the email, the pixel loads
  3. 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:

  1. Go to Campaigns → [Campaign Name]
  2. Scroll to Analytics
  3. 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

  1. Msghub wraps all links with a tracking URL
  2. When the recipient clicks a link, Msghub records the click
  3. 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:

  1. Go to Campaigns → [Campaign Name]
  2. Scroll to Analytics
  3. 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:

  1. Removes hard bounces from your contact list
  2. Retries soft bounces
  3. 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

  1. Go to Contacts → Segments
  2. Click Create Segment
  3. Add conditions:
    • Tag — Contacts with specific tags
    • Property — Contacts with specific properties
    • Behavior — Contacts who performed specific actions
  4. 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.

Msghub automatically adds:

<a href="https://your-msghub.com/unsubscribe/{{messageId}}">Unsubscribe</a>

When a recipient clicks unsubscribe:

  1. They're removed from your email list
  2. Msghub records the unsubscribe event
  3. 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

  1. Check email address — Is it valid?
  2. Check sender — Is the from address verified?
  3. Check spam folder — Is the email in spam?
  4. Check provider — Is your email provider working?

Low open rate

  1. Check subject line — Is it compelling?
  2. Check timing — Are you sending at the right time?
  3. Check content — Is the email relevant?
  4. Check list quality — Are the email addresses valid?

High bounce rate

  1. Verify emails — Use email verification before sending
  2. Clean list — Remove invalid addresses
  3. Check sender — Is the from address verified?
  4. Check content — Is the email triggering spam filters?

See Also