From b27ccb33ab4c2a097babacce5e968627dc0202b9 Mon Sep 17 00:00:00 2001 From: Malin Freeborn Date: Tue, 28 Apr 2026 02:10:39 +0200 Subject: [PATCH] note: how to send email --- chat/send_email.md | 76 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 chat/send_email.md diff --git a/chat/send_email.md b/chat/send_email.md new file mode 100644 index 0000000..4ac21db --- /dev/null +++ b/chat/send_email.md @@ -0,0 +1,76 @@ +--- +title: Send an email with a CLI command +tags: +- email +requires: +- data/pass.md +--- + +# Setup the Config + +Install `msmtp` and set up the defaults. + +```sh +mkdir ~/.config/msmtp/ +cat > ~/.config/msmtp/config << EOF +defaults +tls on +auth on + +EOF +``` + +You'll need to fill in some variables, like your provider's hostname and SMTP port. +The `${pass_name}` is just the `pass` command which gives your email password. + +```sh +name=posteo +host=posteo.de +port=587 +user=bob@posteo.net +pass_name=posteo.net +``` + +With those in, add that default account. + + +```sh +cat >> ~/.config/msmtp/config << EOF + +account ${name} +host ${host} +port ${port} +user ${user} +from ${user} +passwordeval pass ${pass_name} + +``` + +Finally, set this as the default account: + + +```sh +account default : ${account} >> ~/.config/msmtp/config +``` + +# Write an Email + +Fill out the headers in a file called `mail`. + +``` +From: MSMTP ${user} +Subject: Pipes +To: ${recipient_name} <${recipient_email}> + +A pipe gives a wise man time to think and a fool something to stick in his +mouth. +``` + +# Send + +Send the email: + +```sh +msmtp -t bindrpg@posteo.uk < mail +``` +