l: init review-mail-queue

This commit is contained in:
lassulus 2020-04-18 14:57:21 +02:00
parent 4e97430ef6
commit eeeff5f7d4
2 changed files with 41 additions and 0 deletions

View File

@ -113,6 +113,8 @@
]; ];
in { in {
environment.systemPackages = [ pkgs.review-mail-queue ];
krebs.exim-smarthost = { krebs.exim-smarthost = {
enable = true; enable = true;
dkim = [ dkim = [

View File

@ -0,0 +1,39 @@
{ pkgs }: let
review = pkgs.writers.writeBash "review-mail" ''
mail="$1"
${pkgs.exim}/bin/exim -Mvc "$mail" | grep -E 'Subject:|To:'
${pkgs.exim}/bin/exim -Mvl "$mail"
while :; do
read -p 'delete?' key
case "$key" in
v*)
${pkgs.exim}/bin/exim -Mvc "$mail"
;;
d*)
${pkgs.exim}/bin/exim -Mrm "$mail"
break
;;
r*)
${pkgs.exim}/bin/exim -Mt "$mail"
break
;;
n*)
break
;;
esac
done
echo '-------------------'
echo '-------------------'
echo '-------------------'
echo '-------------------'
echo '-------------------'
'';
in pkgs.writers.writeBashBin "review-mail" ''
for mail in $(${pkgs.exim}/bin/exim -bp \
| ${pkgs.gnugrep}/bin/grep frozen \
| ${pkgs.gawk}/bin/awk '{print $3}'); do
${review} "$mail"
done
''