Program which sends many letters on aws engine, with using html
/text
templates.
- Prepare and set your params on
data.csv
file - Prepare your
html
ortext
template with variables fromdata.csv
- Run program, and it will send letters.
-
Prepare
.env
file (You will do it only 1 time). Seeexample.env
file and fill.env
file, or run program withenv
params. -
Prepare
data.csv
file. Example:
EMAIL,name,TEMPLATE_FILE,SUBJECT
example@example.com,Dias1c,templates/example.html,My Example subject
example@example.com,MyName,templates/example.txt,Text letter
example@example.com,,,
Explaining. We will use this file for template to fill it and send it to emails. This file is
csv
type, and first line contains onlykeys
, and all next lines contains values tokeys
.
Variable Keys:
EMAIL
- user email and variablename
- variableTEMPLATE_FILE
- template file path and variableSUBJECT
- subject of letter and variable
Program uses go builtin
text/template
,html/template
packages. And to know "how to create own template", this guide will help you.
- Run: The program for sending letters based on the submitted data
# By default uses `data.csv` file for sending letters or use flag --data-file="YOUR_DATA_FILE"
go run ./cmd/quick/main.go
On running program, it uses params. And this params we can set from different ways. Params also has priority. Priority of params from:
1. Data file
2. Args
3. .env file
If we set
subject
as flag argument, and set it indata.csv
file, program will usesubject
fromdata.csv
.