aboutsummaryrefslogtreecommitdiff
path: root/getmails-alternative
blob: cf36e5e136cd8ac7a053b1e95c5e1bb6e3cca832 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
#
# Simple wrapper around getmail to fetch from all active accounts.
# Alternative to the getmails(1) wrapper.
#
# Supports different config folders, including configurations stored
# in subfolders of $HOME/.config/getmail.
#
# See http://pyropus.ca/software/getmail/configuration.html#running-commandline-options
#

# Parameters
CONFIG_FOLDER="${1:-$HOME/.config/getmail}"
GETMAIL="/usr/bin/getmail"

# Check
if [ ! -d "$CONFIG_FOLDER" ]; then
  exit
fi

# Dispatch
ls -1 $CONFIG_FOLDER | grep -v '^oldmail-' | grep '@' | grep -v '.disabled$' | xargs echo | sed -e 's/ / --rcfile /g' | xargs $GETMAIL -g$CONFIG_FOLDER --rcfile