Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

A lightweight program that runs in background to check mail?

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
bedtime
Posts: 146
Joined: 2012-12-16 19:34
Has thanked: 1 time
Been thanked: 6 times

A lightweight program that runs in background to check mail?

#1 Post by bedtime »

I am using mutt (actually, neomutt). I like using it to read emails, but as far as checking them, I have keep xterm open with it running as I don't know how to run it in the background or if it's capable of doing that. Also, it takes 18mb (+xterm), which, IMO, is too much for what I use it for.

I would like to setup mutt or some other lightweight email app to run in the background and alert me upon a new received email; it should not need to be launched in X; I only want it to perhaps run a command (or some such way of alerting me) upon a new email.

As for reading emails, I am fine with using mutt.

Any ideas?

*EDIT*

Looks like I might have inadvertantly clicked on the mailbox? Anyways, further tests show it's working and not reseting before I click on it. I'll mark as solved if it stays as such.

Thanks!
Last edited by bedtime on 2018-02-01 18:31, edited 1 time in total.

User avatar
bw123
Posts: 4015
Joined: 2011-05-09 06:02
Has thanked: 1 time
Been thanked: 28 times

Re: A lightweight program that runs in background to check m

#2 Post by bw123 »

You could split it up into several tasks. There are probably solutions that do both.

Check for new email, many many ways to do it.
https://duckduckgo.com/html/?q=linux+check+email+cli

Notify yourself, many many ways to do it.
https://duckduckgo.com/html/?q=linux+notify+cli

Code: Select all

#!/bin/sh
# /home/me/bin/checkmail.sh}
# this runs from ~/.fluxbox/apps on startup
# [startup] {/home/me/bin/checkmail.sh}

sleep 3
if [ -s /var/mail/me ] ; then
        echo "You have mail in /var/mail/me" | \
        aosd_cat -y 35 -x -10 -e 1 -p 2 -d 5 -t 2 -f 300 -u 5000 -o 1000 \
        -n "terminus bold 20"
fi

resigned by AI ChatGPT

bedtime
Posts: 146
Joined: 2012-12-16 19:34
Has thanked: 1 time
Been thanked: 6 times

Re: A lightweight program that runs in background to check m

#3 Post by bedtime »

bw123 wrote:You could split it up into several tasks. There are probably solutions that do both.

Check for new email, many many ways to do it.
https://duckduckgo.com/html/?q=linux+check+email+cli

Notify yourself, many many ways to do it.
https://duckduckgo.com/html/?q=linux+notify+cli

Code: Select all

#!/bin/sh
# /home/me/bin/checkmail.sh}
# this runs from ~/.fluxbox/apps on startup
# [startup] {/home/me/bin/checkmail.sh}

sleep 3
if [ -s /var/mail/me ] ; then
        echo "You have mail in /var/mail/me" | \
        aosd_cat -y 35 -x -10 -e 1 -p 2 -d 5 -t 2 -f 300 -u 5000 -o 1000 \
        -n "terminus bold 20"
fi

Thank you for the links. Most of what I've checked online seems to be programs that are far too complicated for me.

Right now I have:

Code: Select all

st -e 'while true; do (sleep 10; pkill neomutt; clear; echo "Resting 10 minutes before next mail check...")&; neomutt; sleep 600; done' &
This puts a background kill process which launches after 10 secs (just enough time for mutt to check the inbox and fire off a command if any new mail) and then waits 10 minutes to repeat. Crappy, but it seems to work.

Still, it is not what I'm looking for as it does not run in the background and requires an X process.

User avatar
pylkko
Posts: 1802
Joined: 2014-11-06 19:02

Re: A lightweight program that runs in background to check m

#4 Post by pylkko »

So, presuming you might have heard of mailnag but perhaps that does not count as "light weight"/does not work with mutt?

shep
Posts: 423
Joined: 2011-03-15 15:22

Re: A lightweight program that runs in background to check m

#5 Post by shep »

I am using mutt (actually, neomutt). I like using it to read emails, but as far as checking them, I have keep xterm open with it running as I don't know how to run it in the background or if it's capable of doing that. Also, it takes 18mb (+xterm), which, IMO, is too much for what I use it for.
This capability has been around since the early days. Rather than running mutt in the background, your can run fetchmail or getmail in the background (daemon mode) and use biff or xbiff for notification.

bedtime
Posts: 146
Joined: 2012-12-16 19:34
Has thanked: 1 time
Been thanked: 6 times

Re: A lightweight program that runs in background to check m

#6 Post by bedtime »

pylkko wrote:So, presuming you might have heard of mailnag but perhaps that does not count as "light weight"/does not work with mutt?
Yeah, too many deps. Thank you for posting, though.
shep wrote:
I am using mutt (actually, neomutt). I like using it to read emails, but as far as checking them, I have keep xterm open with it running as I don't know how to run it in the background or if it's capable of doing that. Also, it takes 18mb (+xterm), which, IMO, is too much for what I use it for.
This capability has been around since the early days. Rather than running mutt in the background, your can run fetchmail or getmail in the background (daemon mode) and use biff or xbiff for notification.
Thank you. I used this suggestion and chose to run getmail which is triggered by crontab every few minutes (as per the Arch Linux instructions: https://wiki.archlinux.org/index.php/Getmail). Xbiff scans the mail dir of getmail and pops up upon a new mail. All works fine, as it should.

But, the one final issue is that, though xbiff properly notifies me of new mail, it resets after the next check, so if I miss the beep or visual during that time frame between check to check, then I would miss the notification.

I've read the man pages of both xbiff and getmail and did not see anything pertaining to this.

Any way to get the notification to stay?

shep
Posts: 423
Joined: 2011-03-15 15:22

Re: A lightweight program that runs in background to check m

#7 Post by shep »

Any way to get the notification to stay?
I think this depends on your desktop. If you have a system tray, it is possible to have an icon appear in the tray. I think that there may be yad or zenity scripts (notification) that a web search will find. I think the script would entail directing the biff/xbiff output to the notification script.

Edit: This Arch forum thread has a couple of links:https://bbs.archlinux.org/viewtopic.php?id=172510

I believe Windowmaker also had some freedesktop compliant email system tray apps.

Post Reply