A lightweight program that runs in background to check mail?

Kernels & Hardware, configuring network, installing services

A lightweight program that runs in background to check mail?

Postby bedtime » 2018-01-29 17:58

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.
bedtime
 
Posts: 32
Joined: 2012-12-16 19:34

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

Postby bw123 » 2018-01-29 18:50

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

User avatar
bw123
 
Posts: 2749
Joined: 2011-05-09 06:02
Location: TN_USA

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

Postby bedtime » 2018-01-29 23:37

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.
bedtime
 
Posts: 32
Joined: 2012-12-16 19:34

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

Postby pylkko » 2018-01-31 20:28

So, presuming you might have heard of mailnag but perhaps that does not count as "light weight"/does not work with mutt?
User avatar
pylkko
 
Posts: 1232
Joined: 2014-11-06 19:02

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

Postby shep » 2018-01-31 21:16

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.
shep
 
Posts: 158
Joined: 2011-03-15 15:22

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

Postby bedtime » 2018-02-01 18:07

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?
bedtime
 
Posts: 32
Joined: 2012-12-16 19:34

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

Postby shep » 2018-02-02 01:17

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.
shep
 
Posts: 158
Joined: 2011-03-15 15:22


Return to System configuration

Who is online

Users browsing this forum: No registered users and 4 guests

fashionable