Creating Sendy compatible csv to import list of emails

Sendy is a self hosted email newsletter application that lets you send trackable emails via Amazon Simple Email Service (SES). This makes it possible for you to send authenticated bulk emails at an insanely low price without sacrificing deliverability.

Now, lets say you have got a list of emails which is created using people subscribed to your website, portal, application etc. The list of emails is one email per line in the subscribed list file. For example like below (filename : email_list.txt ),

user1@example.com
user2@example.com
user3@example.com

We can’t import this list of email id’s as is into Sendy, since it expects the format of the csv file to be imported as, “User Name”,”User Email” … since we don’t know the user names to create compatible csv which we can use to automatically add new email list to sendy, we will use below script which reads every line i.e. every user email ids and create a compatible csv as,

$ vim prepare_sendy_csv.sh
#!/bin/bash
EMAIL_LIST_FILE=$1
rm -rf sendy_emails_for_import.csv
while read line
do
        USER_EMAIL=$line
        echo $USER_EMAIL,$USER_EMAIL >> sendy_emails_for_import.csv
done < $EMAIL_LIST_FILE
$ bash prepare_sendy_csv.sh email_list.txt

Once you run this script, you will see output file sendy_emails_for_import.csv created as,

user1@example.com,user1@example.com
user2@example.com,user2@example.com
user3@example.com,user3@example.com

Now, you can use this sendy_emails_for_import.csv file to import any emails to sendy.

Leave a Comment