commit 9f79ff2fc20697d6b27671f7b4875ed2c02c9922 parent 2a9b541023a86dd1e3bca8b37b7ae4c54a1c277c Author: Jacob R. Edwards <jacob@jacobedwards.org> Date: Fri, 2 Jun 2023 13:56:38 -0700 Add mail fetching utilities Fetchmail is a wrapper around incmailaway for multiple servers, and Inc calls fetchmail followed by inc(1), part of mmh(1). Diffstat:
| A | local/bin/bin/Inc | | | 6 | ++++++ |
| A | local/bin/bin/fetchmail | | | 24 | ++++++++++++++++++++++++ |
2 files changed, 30 insertions(+), 0 deletions(-)
diff --git a/local/bin/bin/Inc b/local/bin/bin/Inc @@ -0,0 +1,6 @@ +#!/bin/sh +# Copyright May 2023 Jacob R. Edwards +# include mail into mmh after fetching it from mail servers + +fetchmail "$@" +inc -form scan.inc diff --git a/local/bin/bin/fetchmail b/local/bin/bin/fetchmail @@ -0,0 +1,24 @@ +#!/bin/sh +# Copyright May 2023 Jacob R. Edwards +# Fetch mail from servers listed in 'mymail' or those listed as +# arguments. + +if test $# -gt 0 +then + users="$*" +else + users="$(sed '/^[ ]*#/d' < "${XDG_CONFIG_HOME:-"$HOME/.config"}"/mymail)" +fi + +port=10110 +for user in $users +do + echo $user + incmailaway -p $port $user || { + echo 'Unable to fetch mail from' $user + status=1 + } + port=$(expr $port + 1) +done + +exit $status