Giter Club home page Giter Club logo

mailmerge's Introduction

Mailmerge

A bare-bones mailmerge script.

How it works

The mailmerge combines a CSV file of email addresses and associated data, with a TEXT file containing the subject and body of an email.

It uses the headers of the CSV file to replace placeholders in the email template.

Take a look at test.csv (the data) and test.txt (the email template) for an example.

Required fields

The CSV file must have a header named email, which contains the email addresses used to dispatch the emails.

Setup

Install the dependencies using bundler.

bundle install

Create a .env file, and define the SMTP settings:

cp env.example .env
# edit .env

That can be whatever SMTP settings you have. Sendgrid, Mailgun, Gmail, etc.

If you want to send email from your Gmail account, you can set up an application-specific password, in https://security.google.com/settings/security/apppasswords

SMTP_LOGIN=<your gmail address>
SMTP_PASSWORD=<your app-specific password>
SMTP_PORT=587
SMTP_SERVER=smtp.gmail.net

Sending Emails

Send emails with the following command:

CSV=foo.csv TEMPLATE=bar.txt ./mailmerge

If you don't pass the CSV and TEMPLATE arguments, then the script will use the defaults:

CSV=test.csv
TEMPLATE=test.txt

Email Template

The first line of the template file is used for the subject line.

The rest of the file is used as the body of the email.

Each header can be referenced in the email template using the header name, enclosed in double curly-braces (e.g. {{username}}).

See test.txt for an example.

mailmerge's People

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

nynhex nayafia

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.