Here is a free software to send bulk email from Windows command line with mail merge. This tool allows you to create a mail merge template and a corresponding database file to map the mail merge fields. You can customize the mail merge template and rest of the email body according to your needs. And then this software will let you send emails to multiple people from command line. And the email that you send using it, will reach to each person individually. Each email will be customized as per the mail merge fields that you provide.
Only limitation of this software is that you can’t add attachment to your emails. If you want to send emails with attachments, then you can try this method.
How to Send Bulk Email from Windows Command Line with Mail Merge?
If you have ever used any mail merge software or online mail merge using PowerPoint, then you may have an idea how this works. There are some mail merge fields in the email body defined in an external file. And the same process is followed here in the case of this mailmerge command line tool.
mailmerge uses a text file to store the email template along with the mail merge fields. It also creates a CSV file there to define the values for the mail merge fields. Additionally, there is a configuration file which stores the credentials of the sender’s email and other SMTP server parameters. You just have to run the command to send emails to the desired recipients.
Here are simple steps to send bulk email from Windows command line:
Step 1: This software requires Python to be installed on your PC. After installing Python, open the command prompt and run the following command in it. This command will install mailmerge on your PC. After successful installation, you can close it.
pip install mailmerge
Step 2: Now, navigate to any folder and again open command prompt using Shift +Right-click. After that run the following command. This command will create three files in the same folder where you have opened the command window. The files it create are: mailmerge_database.csv, mailmerge_template.txt, and mailmerge_server.conf.
mailmerge --sample
Step 3: In the mail merge template file, there is a default body of email, but you can also customize it. For customization, you can create a desired mail merge fields and enclose them in double braces. See the following screenshot.
Step 4: Now, the mail merge fields that you have placed in the template file need to be defined in the “mailmerge_database.csv” file for mapping the values. So create a column in the CSV file for each mail merge field that you have used in the template file. But don’t include braces in the name of the column. Also, you can enter the values in the respective rows, which will be mapped from this file to the email template.
Step 5: Open the mailmerge_server.conf file and then specify the SMTP settings according to the email provider you are using. By default, the settings are for Gmail, so if you want to use Gmail to send email, then just put your mail address there in front of “username” parameter.
Step 6: Now, to send the email, run the following command. It will ask you to enter the password for your email account that you have specified in the configuration file. It will not echo the password on command window.
mailmerge --no-dry-run --no-limit
As you provide the password, it will start sending the emails one by one, as you can see it in the above screenshot.
In this way, you can easily bulk send email from Windows command line with mail merge. In case command line is not your thing, there are other tools as well that let you send bulk Gmail emails as individual emails.
Closing Words:
mailmerge is a pretty good command line tool to send emails with mail merge. You can use any SMTP service with it to send bulk emails from command line. I wish it had option to send attachments as well.