all repos — mail2mms @ 07efac0e7f9b8868f32a1963cd2228f02e84a2ce

YOU'VE GOT MAIL! notify via MMS of new mail in your inbox

use mbsync and fix some bugs
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE-----

iQJDBAABCAAtFiEEkFh6dA+k/6CXFXU4O3+8IhROY5gFAmErAJ8PHG5pbGl4QG5p
bGZtLmNjAAoJEDt/vCIUTmOYgJEP/AyfjJNC9ByZb9LMXHgcDvIa/7Xde+puPi9j
b5lfvIHqI0jzYNcVAqvubzfvHnPbRPmKSAYLWaD7NlZlysuxsEv+Swy/ggqE5urG
XsRIs/GWKu8AahY/3Dz9yJXuaWxfcU8tXjKFkKHqq6HQ3IUaENPM8qLN+XA00+f8
snEmFActT9ZLojjQHjIab67keI46oTSAFovFXByBMd5RYwAxbb4zBL5G8EUFQ2yV
vEM9xiDb+cLuc5ynAca5Ff7ExSfR8r5SE4T6OG6n7NvaSZnKM0gpgfSk4E2HdGIB
usFK623MMlYY3z5jF+R2SkjUbIqaV6JG+C7D9CpDui0ncUhcokrFSN9uuHaNoFUj
VCC1eYRiKW7ZbL9I8M4mpw0UBgmF2YyRPB7D8T+GXjW38PIvGoMA7Jk8Lkew4cY4
eTIKM8vf7MURKTxkq0slxMolrppHFruFg9Xlq7C24dweb19YBQE9Lzy5zeOAHM1c
jWeIWqCrVTZKELmtYIQCLyZRqtP7+DTXJZWbFDkrCBygS00SKkV2lDuaiPbS5Aqd
8zvDc2ZwfeYhPdVVRKoktBB29P734CL+yNpFZfFYlVLwrDblvHBIcXHXoFK9HqDg
z9YTyfryJqmiuB2g/S76POwKts1UhWKWDDJuoG3bXGwv6qOzNYp/NbKi/yt8/6Hc
wQWRvZeF
=AMAI
-----END PGP SIGNATURE-----
commit

07efac0e7f9b8868f32a1963cd2228f02e84a2ce

parent

a73e912971f716485fa2cff05eb5fcc0252c193d

1 files changed, 6 insertions(+), 11 deletions(-)

jump to
M mail2mms.shmail2mms.sh

@@ -5,8 +5,7 @@ # The message will have the number of new mails in the subject

# and the body will contain the From and Subject fields of up to the 3 # most recent new mails. If the new mail count is above 3, there will also # be 'and more...' at the end. -# Assumes you have a maildir inbox on this machine; -# you can use offlineimap or similar to sync recent mail to a maildir +# Assumes you either have mbsync setup to sync your inbox folder, # or use -l if this machine is actually your mailserver # import the config file ./.config

@@ -23,7 +22,7 @@ oldnew=0

summary() { i=0 - for m in $(ls -1r ${inbox}/new/*); do + for m in $(\ls -1r ${inbox}/new/*); do i=$((i + 1)) if [ ${i} -gt 3 ]; then echo "and more..."

@@ -39,17 +38,13 @@ }

while true; do - # Start offlineimap if it's not running and we are not on the mailserver - # Sometimes it can crash, so it's in the loop here instead of at startup - - if [ "$1" != -l ]; then - if ! pgrep offlineimap; then - offlineimap & - fi + # sync mailbox if this is not the mailserver + if [ "$1" = "-l" ]; then + mbsync -a fi # Count the number of new mails - newnew=$(ls -1 ${inbox}/new | wc -l) + newnew=$(\ls -1 ${inbox}/new | wc -l) # If the number of new mails has increased if [ ${newnew} -gt ${oldnew} ]; then