Order, payment and delivery emails for online shops in Kenya

After a customer pays, the first thing they look for is the confirmation email. JMSURF Mail sends it from your shop's own domain within seconds and tells you if it was delivered.

The order journey, email by email

  1. Order received: what they bought, the total and how to pay.
  2. Payment received: the M-Pesa receipt number and amount. If you take M-Pesa through JMSURF PAY, send this from your payment webhook.
  3. Order shipped: rider or courier details and tracking.
  4. Delivered: thank-you note and how to get help.
  5. Invoice: a PDF attached for business customers.

Example: payment receipt with a PDF

PHP
$pdf = base64_encode(file_get_contents("/tmp/receipt-SV-1024.pdf"));
$body = [
  "from" => "Savannah Shop <[email protected]>",
  "to" => $order["email"],
  "template" => "payment-received",
  "variables" => ["name" => $order["name"], "order" => "SV-1024", "receipt" => $mpesaReceipt, "amount" => "KES 3,450"],
  "attachments" => [["filename" => "receipt-SV-1024.pdf", "content" => $pdf, "content_type" => "application/pdf"]],
  "tags" => ["receipt"],
];
$ch = curl_init("https://api.jmsurfmail.co.ke/api/v1/emails");
curl_setopt_array($ch, [
  CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => ["Authorization: Bearer " . getenv("JMSURF_MAIL_KEY"), "Content-Type: application/json", "Idempotency-Key: receipt-SV-1024"],
  CURLOPT_POSTFIELDS => json_encode($body),
]);
$result = json_decode(curl_exec($ch), true);

The Idempotency-Key matters for shops: payment callbacks are often delivered more than once, and the key makes sure the customer gets one receipt, not three. Full PHP set-up is in the PHP guide.

Why shop emails go to spam, and how to avoid it

  • Sending from a free mailbox (a Gmail or Yahoo address) through a website plugin. Use your shop's domain and verify it; see SPF, DKIM and DMARC for .co.ke.
  • Mixing promotions with receipts. Keep receipts transactional. JMSURF Mail is for transactional email, not bulk marketing.
  • Repeating sends to dead addresses. JMSURF Mail suppresses bounced and complaining addresses automatically. See delivery logs.

Busy days and flash sales

Use POST /emails/batch to send up to 100 emails in one request, with a template and different variables for each. The API accepts 20 requests a second per key. Choose a plan whose monthly allowance covers your peak month; Business includes 10,000 emails and Scale 20,000. See pricing.

Email plus SMS for orders

Many Kenyan shoppers check SMS first. Add an sms object to the same request and a short "Order SV-1024 shipped" text goes through your JMSURF SMS account. See email and SMS.

Questions

Can I send from a WooCommerce or other shop platform?
Any platform that lets you run code or call a webhook can call the JMSURF Mail API. There is no ready-made plugin yet, so a developer adds a few lines that call POST /emails.
How do I know a receipt arrived?
Open the email in the dashboard to see its timeline, or receive the email.delivered webhook on your server.

Send your first email today

Free plan with 100 emails a month, no card needed. Questions? WhatsApp or call +254 712 504 593, or email [email protected].