Python Mailmerge Library

Fri 02 June 2023 by Dr. Dirk Colbry

Picture of a black hole to represent a singularity

I just posted a library in my gitlab repository which runs a mailmerge program on our jupyterhub server here at MSU. I use this every week to improve a lot of my email workflows from sending feedback to students to emailing different groups weekly reports. I like that it just uses a pandas dataframe. Here are the basic steps to use the program.

  1. Create a pandas dataframe with each row representing an email you want to send and each column representing the things you would like to be different in each email. Typically there is an Email Address column and maybe a Name column but you can add anything you want.
  2. Create an eamil "template" using the library. THe template consists of some common email feilds. You want to fill out each feild as a string. You include \<\<TAG>> syntax where the TAG is the name of a column in your pandas dataframe. This is what will get replaced when you send each email.
  3. Run the sendmail function using the template and the dataframe. It is easy as that.

Please check it out and let me know what you think.

https://gitlab.msu.edu/colbrydi/mailmerge

  • Dirk

Comments