Occasionally, I get the feeling that not everything I build needs to be a commercial project. While sustainability is an issue, I still believe there is a realm for free and open-source projects. In some cases, the core value provided by a side project doesn't justify the additional work to add payments and the required management infrastructure behind it. Naturally, this leads to a project with less features. But that's fine with me, as I want to solve only a particular problem and don't aim to build an all-encompassing solution with all the whistles and bells.
An alternative path instead of monetizing the project is simply open-sourcing it. This way others can profit from the work done and give back in other forms (e.g. sponsorship, etc.). Open sourcing the source code allows me to disconnect from the feeling I need to make a quick buck from it. Instead, you can give it away for anyone to use and eventually profit in other forms.
For my latest little project, Mail Merge for Linux Bash, I'm following exactly this. With this project I cared really only about one core: feature merging emails and sending them. Existing services are too feature-rich. I wanted something very simple without monthly running costs. So I've built myself a helper script to load a CSV file and fill in a template before triggering a mailto: in Firefox. Chrome should work as well. The project is free for anyone to use.
What you need
While the project itself doesn't have any direct dependencies, your system will need to fulfill some basic requirements:
Linux with bash CLI. I've not tried any other environments, but there is a chance it works on systems of a similar nature (e.g. MacOS). Windows might work, I can't tell as I can't test it.
x-www-browser to be set to your browser. You can adjust this using the command sudo update-alternatives --config x-www-browser. This is usually already done.
A browser supporting mailto:-URLs being executed and directed to your email provider. Firefox 73 does this by default. You can test this by clicking this link: mailto:email@example.com. If your email inbox opens with a new email you are good to go. This might require an additional confirmation when you are using this for the first time.
PHP 7.4 or newer. This will be raised as PHP versions go out of support.
Fill in your CSV file and name it targets.csv. You can define any number of headers within the file and use them in your template. You should always have at least the following headers: Subject and Email as the script uses these two.
Write your template file and name it template.txt. Within the template file you can use any headers defined in the CSV file. The subject line should always be the first line of the template, followed by two line breaks and should start with Subject:. Please note that you should use all headers in capital letters within the template file. So, Email would be transformed to EMAIL automatically.
Run php generate.php to trigger the merge of the content and the related mailto: commands. You might need to allow these actions to be triggering your provider email (e.g. Gmail).
While working on fine-tuning your template and testing the headers it might pay off to use only one or two lines in your CSV. Once everything is in order, you can run the whole data set.
You can support my open source work and the development through Buy me a coffee. Social shares are also appreciated. You can stay tuned for updates and new projects by subscribing to my newsletter.
Did you like this article?
Besides tones of crap, the web also has lots interesting open-source libraries, actually innovative side-projects and awesome free knowledge. Once in a while, I share these awesome web-findings via email. If this sounds like something you are into, subscribe below: