[Cialug] MailMerge

Matthew Nuzum newz at bearfruit.org
Tue Apr 22 10:29:04 CDT 2014


Programming language of your choice + template engine of your choice =
success.

For example, I would probably use mailgun or sendgrid + Node.js if I wanted
strong support for ensuring delivery, or Nodemailier if I wanted to do
delivery myself. I'd couple that with Mustache or Handlebars to generate
the email bodies.

You can do this with any programming language you like.

template = compile template from disk or memory
mail = mail server connection

for email in emaillist
  data = fetch info for email
  msg = template.build(data)
  headers = {to: email, from: me, subject: 'something ' + data.subject}
  mail.send(headers, msg)
  if mail.err
    log("couldn't send to "+email)


Whatever you do, I strongly suggest using both plain text and HTML parts in
one. Whenever I see plain text emails come through, I really think it looks
amateur. You don't have to get crazy with the formatting, all you need in
your HTML is h1, h2, p, strong, a, ul/ol, li. [1]

Do make sure the first sentence of the plain text version concisely
summarizes the nature of the email, since that's what email clients use for
their preview.

Don't forget about mailchimp, which also does this and is free for small
batches, and cheap for larger ones.

[1] Here's a good, well tested open source HTML email template for free
http://htmlemailboilerplate.com/


On Mon, Apr 21, 2014 at 5:28 PM, L. V. Lammert <lvl at omnitec.net> wrote:

> Definitely not Word or Write, ... but a simple way to take a template file
> and a list of data/emails and produce individual emails.
>
> Primary need is to include specific data in the email body, as when using
> BCCs the recipient is obscured.
>
> I see a mailmerge in Perl, but looking to see if that's the best option.
>
>         Thanks!
>
>         Lee
> _______________________________________________
> Cialug mailing list
> Cialug at cialug.org
> http://cialug.org/mailman/listinfo/cialug
>



-- 
Matthew Nuzum
newz2000 on freenode, skype, linkedin and twitter

♫ You're never fully dressed without a smile! ♫


More information about the Cialug mailing list