Customize Mass Emails with Gmail – Mail Merge Tutorial


I day dream about a free, full-fledged Google CRM product native to Gmail. I’m closer now with the ability to send customized mass emails from Gmail. It’s not the “perfect mass email solution”, but it:

  • Is Free
  • Uses Gmail/Google Docs only
  • Is Google Contacts friendly

This tutorial is based off an excellent post by Amit Agarwal and utilizes a script written by Romain Vialard.


Step 1: Create a draft of your message

Open Gmail and compose a draft of your message.



Step 2: Replace the recipient’s name with a variable

If you are sending the email to Tom, replace his name with the variable $%First Name%. The variable enables the script to pull data from a spreadsheet of hundreds of names and emails and customize each message.



Step 3: Copy this mail merge spreadsheet into Google Docs

Click the link above and then click “yes, make a copy”. This will copy the spreadsheet template and associated script into google docs. If you want to peruse the code before copying, check it out here.



Step 4: Copy your mailing list into the spreadsheet

There are lots of ways you could copy your mailing list into the spreadsheet. This is one of them. Open the spreadsheet you just copied. Notice that there is a column for First Name and a column for Email Address. We will go into gmail’s contacts to export the first names and emails from our mailing list (if you know of a script that will import them directly, please message me in the comments).

In Gmail, click on the Gmail link with a little red arrow in the upper left corner and select Contacts.



In Contacts, select the users you would like to mail. I spent time creating lists of users so I can select my target list easily (like family).



Export the list to Outlook CSV format.



Open the list in Excel (or google spreadsheets) and delete all columns except the first name and email address.



Copy the two columns into the mail merge spreadsheet in Google Docs



Step 5: Start the Mass Mailing

– In Google Docs, go to the Mail Merge menu and select Start Mail Merge. Grant it authorization. Observe that it still has not sent the mailing (kind of confusing). All this did was grant the authorization. You have to click the button again for it to work.

– Click on Start Mail Merge again to open the mailing options.



Step 6: Select your email template

From the drop down menu, select the draft you composed in Gmail.


Step 7: Write in your name

The form asks you to “Please write the sender’s full name”. This will appear as the name next to your email address in the email header.


Step 8: Start the mailing!

Click Start Mail Merge and the spreadsheet will print a confirmation after each email sends. Note: Gmail  caps the number of emails you can send in a day to 500 (UPDATE: as it turns out, Google limits the number of emails you can send with scripts. It’s limited to 100 per day for the free gmail, the formerly free version of Google apps for domains, and it’s 1,500 per day for the paid version of google apps). Business accounts can send 2000 1500 if you have Google Apps.


Did These Instructions Work For You? Buy Me a Drink!

If these instructions worked for you (or one of the questions below helped you trouble shoot) feel free to express your gratitude by buying me a drink (powered by PayPal)! I’ll even link back to your business (unless you’d like to stay anonymous):

Total Drinks So Far (updated 9.12.16)

$1.00 from Sergio: Thanks for the coke!

$5.00 from Paul: Thanks for the draft beer!


Potential Problem (and Solution) By Adding Images: The ‘Error encountered: Cannot call method “copyBlog” of undefined.’ Error.

When you add an image to your email, do you get the error ‘Error encountered: Cannot call method “copyBlog” of undefined.’? To solve this, remove the image from your draft and then add it back in. The process of removing it and then adding the exact same image back makes the error go away.


Error, be gone!


Potential Gotcha With Images: Error encountered: Cannot read property “1” from null

Some people are reporting the error  ‘Error encountered: Cannot read property “1” from null.’ in the comments. It seems to be related to placing images inside the body of your email. If you get this error, try removing any images and then sending again and see if the error goes away. Not everyone gets this error, and I’m not sure at this point what causes it. For example, I’ve sent several mailers with inline images and never received the error myself, which makes diagnosing it further almost impossible. If you have insight on this, feel free to share in the comments.

Update as of 9.8.2015

Michela reported in the comments that including the image in the email signature can prevent this error. It’s another option to try if you’re getting this error. Thanks for sharing the tip Michela!


Unauthenticate The Spreadsheet And Revoke It’s Access

This guide requires providing a spreadsheet access to your Gmail Account. If you want to unautheticate and revoke this spreadsheet’s access, follow these steps:

  1. Click this link and go directly to the account page that let’s you manage apps connected to your account. Once there, click on the “MailMergeHD – Digital Inspiration” app and click “REMOVE”.
  2. If the link provided didn’t take you to the “Apps connected to your account screen” then follow these steps:
    1. Login to Google
    2. Click on your “head” icon in the top right. Click “My Account”.
    3. Click “Sign-in & Security”
    4. Click “Connected apps & sites”
    5. Click “Manage Apps”
    6. Click “MailMergeHD – Digital Inspiration” app and click “REMOVE”.


Expanding functionality

For anyone interested in expanding the functionality of this script, two often requested new features include:

1. Recording in the spreadsheet when an email is opened.

2. Send individualized attachments.

3. Setting a delay between each email sent.

Sending Huge Campaigns

If you’re sending out huge mailing campaigns, think about trying a managed service like ConstantContact or MailChimp. If you sign-up for one of these services using these links here, I get a little affiliate marketing bonus, which is much appreciated (you know, if you end up signing-up for them anyway).

Provide Feedback

Feel free to ask questions in the comments if you’re having trouble or provide a thanks if this worked for you. If you liked it, please follow me on twitter or throw some coins into my PayPal powered tip jar!




  1. Pingback: QUERY - Google Script for Gmail

Leave a Reply

Your email address will not be published. Required fields are marked *