• Your Account
  • Pricing
  • FeaturesFeatures and Benefits of Elastic Email
  • CustomersA few of our great customers
  • BlogHome of Elastic Email's Blog
  • API Documentation
  • Get CreditPurchase credit to send emails
  • SupportSupport and help for Elastic Email
  • ContactContact form to send an email to us
SMTP Relay
  • Home
  • FeaturesFeatures and Benefits of Elastic Email
  • PricingPricing and costs of using Elastic Email
  • DocsDocumentation 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)

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

Terms of Use       Privacy Policy
© Copyright 2010-2011 Geographical Media Inc. - About Us