Skip to main content

Format custom variables correctly

Updated today

Learning Objective

By the end of this guide, you'll know how to format custom variables correctly, use fallback values to handle missing data, avoid common syntax errors, and create custom variables through CSV imports to personalize your emails at scale.

Why This Matters

Variables turn one email template into thousands of personalized messages. Without proper formatting, variables break, showing #{{firstName}} instead of "Sarah" or displaying incomplete sentences like "Hi , " when data is missing.

Correct variable formatting ensures:

  • Personalization works for every lead

  • Emails look professional even when the data is incomplete

  • Your campaigns scale without manual editing

What Are Custom Variables?

Custom variables are placeholders in your email that lemlist replaces with lead-specific data when sending.

Example:

  • You write: Hi #{{firstName}}, I noticed #{{companyName}} is growing fast.

  • Lead data: firstName = "Sarah", companyName = "Acme Corp"

  • Email sends as: Hi Sarah, I noticed Acme Corp is growing fast.

Default lemlist Variables

lemlist includes predefined variables:

  • #{{email}}

  • #{{firstName}}

  • #{{lastName}}

  • #{{picture}}

  • #{{phone}}

  • #{{linkedinUrl}}

  • #{{companyName}}

  • #{{icebreaker}}

  • #{{sender.name}}

These work automatically when you import leads with matching CSV column names.

How to Create Custom Variables

Custom variables are created from your CSV column headers.

When you import a CSV:

  1. Default columns (email, firstName, companyName) map to default variables

  2. Any additional columns automatically become custom variables

  3. The column header name becomes the variable name

Example CSV:

email firstName companyName painPoint industry [email protected] Sarah Acme Corp Lead generation SaaS

Resulting variables:

  • #{{email}} (default)

  • #{{firstName}} (default)

  • #{{companyName}} (default)

  • #{{painPoint}} (custom)

  • #{{industry}} (custom)

Use in email:

Hi #{{firstName}},

I know #{{industry}} companies like #{{companyName}} often struggle with #{{painPoint}}.

Variable Formatting Rules

Rule 1: Variables Are Case-Sensitive

#{{firstName}} β‰  #{{firstname}} β‰  #{{FirstName}}

Your CSV column header must match the variable name exactly.

πŸ’‘ Best practice: Use camelCase consistently: firstName, companyName, painPoint

Rule 2: No Spaces Allowed

CORRECT:

  • #{{firstName}}

  • #{{companyName}}

INCORRECT:

  • #{{first name}} – Space breaks the variable

  • #{{ firstName }} – Spaces inside braces break the variable

  • #{{company_name}} – Underscores work, but camelCase is preferred

Rule 3: Correct Brace Format

CORRECT:

  • #{{firstName}} – Two opening braces, two closing braces

INCORRECT:

  • {firstName} – Only one brace

  • #{{firstName} – Missing closing braces

  • [[firstName]] – Wrong bracket type

Using Fallback Values

If a variable is empty for a lead, it displays awkwardly:

Without fallback:

  • Template: Hello #{{firstName}},

  • If firstName is empty: Hello , ← Looks broken

With fallback:

  • Template: Hello #{{firstName|there}},

  • If firstName is empty: Hello there, ← Professional and complete

Fallback Syntax

Format: #{{variable|fallback}}

Examples:

  • #{{firstName|there}}

  • #{{companyName|your company}}

  • #{{industry|your industry}}

Choose natural fallback values:

  • Good: #{{firstName|there}}, #{{firstName|friend}}

  • Bad: #{{firstName|MISSING}}, #{{firstName|[name]}}

Common Mistakes and Fixes

Issue: Variable shows as #{{firstName}} instead of the actual name

Fix:

  • Check CSV column is named firstName (case-sensitive)

  • Verify the lead has data in that column

  • Ensure no spaces in variable: #{{firstName}} not #{{ firstName }}

Issue: Email displays "Hi , " with an extra comma

Fix:

  • Add fallback: #{{firstName|there}}

  • Ensure all leads have firstName data before importing

  • Make sure that there are no extra spaces after first names of leads in your CSV file

Issue: Duplicate variables in the dropdown

Fix:

  • CSV has columns with similar names (e.g., firstname and firstName)

  • Standardize CSV column names before importing

  • Remove duplicate columns

Advanced: Images as Variables

Variables can contain image URLs for personalized visuals.

CSV example:

email firstName companyLogo [email protected] Sarah https://acme.com/logo.png

Use in email (HTML mode):

<img src="#{{companyLogo}}" alt="Logo" width="150">

Each lead sees their company's logo in the email.

πŸ’‘ Note: Custom variables support up to 2,000 characters.

Optimization Tips

Always use fallbacks: Protect against missing data with fallback values for every variable.

Keep names short and clear: #{{painPoint}} is better than #{{leadMainPainPointIssue}}.

Test with missing data: Before launching, test your email with leads that have empty fields to verify fallbacks work.

Standardize naming: Use camelCase consistently across all custom variables to reduce errors.

Validate CSV before importing: Check column headers match your variable names exactly (case-sensitive) before uploading.

Did this answer your question?