EmailJS JavaScript Debugging 4 min read

Why Your EmailJS Template Variables Aren't Showing Up — And the 60-Second Fix

You set up your contact form, wired in EmailJS, hit send — and the email arrives with blank fields where {{name}} and {{message}} should be. Here's exactly what's happening and how to fix it.

B
Mohammed Bilal Meccai
TL;DR
Your emailjs.send() payload keys must exactly match the {{placeholder}} names in your template — same spelling, same case, no exceptions. If your template says {{name}} and your JS sends from_email, that field renders blank. Map every variable explicitly.

The Problem

You’ve built a contact form. You integrated EmailJS — free, no backend, works directly from the browser. Your template looks clean. Your JavaScript looks right. You test it.

The email arrives — but every `` field is blank.

⚠️
**EmailJS does not throw an error when variable names don't match.** The send call succeeds with status 200 — but the template renders empty fields silently. This is why it's easy to miss.

Why It Happens

EmailJS templates use `` placeholders. When you call emailjs.send(), the third argument is a plain JavaScript object. EmailJS matches the object keys to the template placeholder names — character for character, case sensitive.

Any mismatch — different name, extra underscores, different casing — and that variable renders empty. No warning. No error. Just blank.

Here’s the exact mismatch pattern:

// Template uses: , , , , 

// ❌ WRONG — keys don't match template placeholders
emailjs.send(SERVICE_ID, TEMPLATE_ID, {
  from_email: email,   // template expects , not 
  topic:      topic,   // ✓ matches
  message:    message, // ✓ matches
  reply_to:   email,   // not a template variable
});

The template expects and — the payload sends from_email and reply_to. EmailJS finds no match, renders blank.

The Fix

Every key in your emailjs.send() payload must exactly match a `` in your template. Go to your template, list every variable used, mirror them in your JS object.

// ✅ CORRECT — every key matches a template placeholder
await emailjs.send(SERVICE_ID, TEMPLATE_ID, {
  name:    email,          // → 
  email:   email,          // →   (used in Reply To)
  topic:   topic,          // → 
  message: message || '(No message provided)', // → 
  time:    new Date().toLocaleString('en-IN', {
             timeZone:  'Asia/Kolkata',
             dateStyle: 'medium',
             timeStyle: 'short'
           }),             // →   IST timestamp
});
After this fix, every email contains **the sender's email, their selected topic, their message, and an IST timestamp** — with Reply To pre-filled so you can respond in one click.

Variable Mapping Reference

Template Placeholder JS Payload Key What It Sends Used For
`` name Visitor’s email Identify who wrote in
`` email Visitor’s email Reply To field
`` topic Selected option Subject + triage
`` message Textarea content Enquiry body
`` time IST timestamp When they reached out

“Most engineers spend 30 minutes Googling a blank email bug. I looked at the pattern — variable name mismatch — and fixed it in 60 seconds. That’s not luck. That’s systems thinking.”

Quick Checklist Before Going Live

  1. Open your EmailJS template and list every `` used
  2. Confirm every template variable has a matching key in the JS payload
  3. Set Reply To in template settings to ``
  4. Use Test It in the EmailJS dashboard before deploying
  5. Check Email History if a send seems to work but no email arrives

If you’re wiring up a contact form and hitting something the checklist above doesn’t cover — template variables still blank, emails going to spam, Reply To not routing correctly — I’m happy to help. Reach out at bilalmeccai.com/#contact or bilalmeccai@gmail.com.


Frequently Asked Questions

Why are my EmailJS template variables showing as blank?
The variable names in your emailjs.send() payload object don't match the names in your template. EmailJS requires an exact character-for-character match. Check spelling and casing on both sides.
Does EmailJS variable matching work case-sensitively?
Yes. and are different variables. Always use lowercase consistently across your template and JS payload.
How do I set up Reply To in EmailJS?
In the EmailJS template editor, set the Reply To field to . Then include email: userEmailAddress in your JS payload. When you hit reply in Gmail, it goes directly to the visitor.
How do I add an IST timestamp to EmailJS emails?
Pass a time key: new Date().toLocaleString('en-IN', { timeZone: 'Asia/Kolkata', dateStyle: 'medium', timeStyle: 'short' }). Add in your template where you want it rendered.
EmailJS returns 200 but I'm not receiving emails — why?
Check: (1) Gmail service is connected in EmailJS → Email Services. (2) Check spam folder. (3) Check EmailJS → Email History for exact status and error codes.
B
Mohammed Bilal Meccai
Senior DevOps Engineer · Systems Thinker

I turn complex infrastructure chaos into clean, working systems — production ELT pipelines, cloud cost optimisation, AI-native DevOps tooling. I write about the real problems I solve and the patterns I find in systems others miss.

bilalmeccai.com · bilalmeccai@gmail.com

Got an infrastructure problem?
I solve these kinds of problems fast.
Let's talk about yours.
Work With Me →