You might be able to use a little expect in that script to catch and handle mutt's no mail case when that happens.

On Sun, 4 Dec 2016, Matthias Apitz wrote:

Date: Sun, 4 Dec 2016 04:36:50
From: Matthias Apitz <g...@unixarea.de>
To: mutt-users@mutt.org
Subject: fetching mails with mutt/imap


Hello,

Sometimes, when connection to Internet costs a lot of money and is
charged connection time based, I use mutt to fetch directly and fast with a
script like this:


#!/bin/sh
#

# ensure the file exists
touch /usr/home/guru/mailboxtmp

mutt -n -f imap://imap.1blu.de/ \
    -e "set sort=mailbox-order; set confirmappend=no; set delete=yes; push 
'<tag-pattern>.<enter><tag-prefix><save-message>/usr/home/guru/mailboxtmp<enter><sync-mailbox><exit>'"

This works fine and fast. The only issue is: when there is no mail to
read, mutt says "No mail" and does not end by itself. One has to used
'q' to end it. Why?

Thx

        matthias



--

Reply via email to