]> gitweb.fluxo.info Git - utils-mail.git/commitdiff
Feat: minimailer: increase verbosity and adds variable in the template
authorSilvio Rhatto <rhatto@riseup.net>
Thu, 10 Feb 2022 14:01:00 +0000 (11:01 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Thu, 10 Feb 2022 14:01:00 +0000 (11:01 -0300)
minimailer

index 09c66aecc1e1d9ed5aad0c36572082977e00dfc4..8eadd8ab766a631aea459bc37062419fe9069682 100755 (executable)
@@ -12,7 +12,8 @@ To: recipient
 From: myself@mydomain
 Subject: Email Test using MSMTP from File
 
-Hi $recipient! This is an automated message.
+Hi $recipient! This is an automated message to remind
+that your email $address is in our database.
 
 King regards,
 Myself
@@ -54,6 +55,9 @@ cat $RECIPIENTS | while read recipient; do
   # https://linuxconfig.org/extract-email-address-from-a-text-file
   address="`echo $recipient | sed -r 's/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}/\n&\n/ig;s/(^|\n)[^@]*(\n|$)/\n/g;s/^\n|\n$//g;/^$/d'`"
 
-  sed -e "s/\$recipient/$recipient/g" $TEMPLATE | \
+  echo "sending to $address..."
+
+  sed -e "s/\$recipient/$recipient/g" \
+      -e "s/\$address/$address/g" $TEMPLATE | \
     msmtp -a $MSMTP_ACCOUNT $address
 done