Crates.io | listsend |
lib.rs | listsend |
version | 0.4.8 |
source | src |
created_at | 2024-10-19 07:19:10.240177 |
updated_at | 2024-11-13 02:38:38.658979 |
description | Send emails to CSV list from template on CLI |
homepage | |
repository | https://github.com/pepa65/listsend |
max_upload_size | |
id | 1415145 |
size | 51,842 |
Send emails to CSV list from template on CLI
wget https://github.com/pepa65/listsend/releases/download/0.4.8/listsend
sudo mv listsend /usr/local/bin
sudo chown root:root /usr/local/bin/listsend
sudo chmod +x /usr/local/bin/listsend
If not installed yet, install a Rust toolchain, see https://www.rust-lang.org/tools/install
cargo install listsend
cargo install --git https://github.com/pepa65/listsend
git clone https://github.com/pepa65/listsend
cd listsend
rustup target add x86_64-unknown-linux-musl
cargo rel # Alias defined in .cargo/config.toml
The binary will be at target/x86_64-unknown-linux-musl/release/listsend
Even without a full Rust toolchain, rust binaries can be installed with the static binary cargo-binstall
:
# Install cargo-binstall for Linux x86_64
# (Other versions are available at https://crates.io/crates/cargo-binstall)
wget github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-musl.tgz
tar xf cargo-binstall-x86_64-unknown-linux-musl.tgz
sudo chown root:root cargo-binstall
sudo mv cargo-binstall /usr/local/bin/
Only a linux-x86_64 (musl) binary available: cargo-binstall listsend
It will be installed in ~/.cargo/bin/
which will need to be added to PATH
!
listsend 0.4.8 - Send emails to CSV list from template on CLI
Usage: listsend [OPTIONS]
Options:
-c, --csv <CSV> CSV file (name,email,data) [default: ./list.csv]
-t, --template <TEMPLATE> Email template file [default: ./email.tpl]
-s, --smtp <SMTP> SMTP config file [default: ./smtp.env]
-e, --email <EMAIL> Email config file [default: ./email.env]
-r, --readme Output readme file from repo
-h, --help Print help
-V, --version Print version
The whole configuration goes through environment variables that can be set
independently or in the files smtp.env
and email.env
, and through the
email template email.tpl
and the recipients list list.csv
.
Copy the files in example
to your working directory:
smtp.env
file with the data and credentials for the SMTP relay:
SENDLIST_HOST
, SENDLIST_PORT
(default: 465), SENDLIST_USER
,
SENDLIST_PASSWORD
and SENDLIST_FROM
, all are mandatory.email.env
with the data for the email: SENDLIST_REPLY_TO
(default: none),
SENDLIST_CC
(default: none), SENDLIST_BCC
(default: none),
SENDLIST_SUBJECT
(mandatory), SENDLIST_HTML
(default: plain text),
SENDLIST_ATTACHMENT
(default: none), SENDLIST_DELAY
(default: 1 second).export SENDLIST_DELAY=0
.email.tpl
to the desired content, the fields {{name}}
, {{email}}
and {{data}}
from list.csv
can be used in the template file and
in SENDLIST_SUBJECT
(the Subject line). The template can be
plain text (default) or html: set SENDLIST_HTML
to something other than
no
, unset
, false
, 0
or empty.list.csv
for the recipient's data, where the column header is
name,email,data
and following lines specify each recipient.
The fields name
and email
are mandatory, data
is optional.
If #
is used as the first character of a line, it gets ignored.