• Account
  • PricingIt's good.
  • FeaturesBenefits and uses of Elastic Email.
  • CustomersA few of our great customers
  • BlogNews, events and email tips
  • ResourcesSMTP Config and API specs
  • Get CreditPurchase credit to send emails
  • SupportSupport and help for Elastic Email
  • ContactWays to contact us
SMTP Relay
  • Home
  • FeaturesThings you can do with Elastic Email.
  • PricingPricing and costs of using Elastic Email
  • ResourcesDocumentation of our API
  • Get CreditGet Credit for your Elastic Email account
  • ContactContact us
  • Your AccountAccess your elastic email account.
Edit - Delete
Text AreaText Area - Table of Contents
API-Documentation Table of Contents
Edit - Delete
Text AreaText Area - Mail Merge

Mail Merge

Elastic Email supports mail merge functionality so that you can send a single job but support multiple recipients with personalized emails.  

Using this technique you can define an email template which contains special fields such as {firstname}, {lastname} or many others and send personalized emails in a very efficient way to your clients. For example:

Dear {firstname} {lastname},

This is our monthly newsletter. We hope you have been enjoying our service. You can access your account at {link}.

To use the mail merge you need to make two calls to the api. One to upload a CSV (comma separated values) data source file using the upload attachments api and a second call to the send api with the specified datasource.

Step 1) Create a CSV file like the following:

"ToEmail","FirstName","LastName"
"email1@email.com","Joe","Plumber"
"email2@email.com", "Jackie","Smith"

The first column of the data must be ToEmail and will be used as the recipients of the merged email. The other columns represent the data fields that you can use in your email. You can have as many columns as you need. If you have the header FirstName you can include that in your email template with {FirstName} and all references to that field will be replaced before sending.

Step 2) Call the attachments upload api to upload the CSV file.  

To upload your attachment do a HTTP PUT of your attachment file to:

https://api.elasticemail.com/attachments/upload?username=yourusername&api_key=yourapikey&file=test.csv

Step 3) Call mailer send with the datasource value set:

To use the send command POST to https://api.elasticemail.com/mailer/send with the following form values:

  • username=your account email address
  • api_key=your api key
  • from=from email address
  • from_name=display name for from email address
  • subject=email subject 
  • body_html=html email body [optional]
  • body_text=text email body [optional]
  • data_source=your csv file name (eg: test.csv)
  • charset=text value of encoding for example: iso-8859-1, windows-1251, utf-8, us-ascii, windows-1250 and more…
  • encoding for None, 1 for Raw7Bit, 2 for Raw8Bit, 3 for QuotedPrintable, 4 for Base64 (Default), 5 for Uue  note that you can also provide the text version such as "Raw7Bit" for value 1

If sent correctly you will receive a response like:

f74b9f96-f89a-4cfe-813f-5f86df1cb37f

This is the transaction ID of your send job.  You can use this transaction ID to check on the statistics of the given job using the Get Status api.

Your email will be sent to each email address in the CSV file and the data will be merged with the CSV data.

Note: There is a limit of 100000 emails / uploaded CSV file for larger jobs please split into separate calls.

Edit - Delete
Text AreaText Area - Code Samples

Code Samples

Edit - Delete
Html Script BoxHtml Script Box - C#

C#

Edit - Delete
Html Script BoxHtml Script Box - PHP

PHP

Elastic Email

About Us
Terms of Use and Email Policy
Privacy Policy        
Report Spam

Resources

API Documentation
SMTP Configuration Instructions 
Send Mail
Upload Attachment
Activity Log
Mail Merge
Contact List Management

Support

Blog
Knowledge Base
Forums
Support Home

Social

Facebook
Twitter
Linked In
Google+