• Command to Return Number of Unread Emails

    From Computer Nerd Kev@21:1/5 to All on Fri Jan 13 23:35:21 2017
    XPost: comp.os.linux.misc

    I'm looking at building a little display for my unread emails
    and internet data usage, to be connected to my router running
    the OpenWrt firmware. I want to determine the software options
    before starting on the electronics.

    To this end I've been trying to find a Linux command line
    utility (preferably included with, or available in a package
    for, OpenWrt) to simply return the number of unread emails
    in a specified Email inbox. Even more ideal would be the
    inclusion of some obscuration of the password used to access
    the Email account (in other words to not have it stored in
    plain-text on the router).

    The Email server supports IMAP and POP. But I want to read
    the emails directly from the server (not download them to the
    router and access them locally), so I believe that IMAP
    would be the preferred system for remotely accessing a
    count of unread messages.

    So far I've ruled out "nmh" due to apparant lack of IMAP
    support (at least to the degree required here), I'm a
    bit confused about "mail" as far as remote server access
    goes, and I've noted that writing a custom program or
    script to send the few required IMAP commands directly
    might not be all that difficult.

    --
    __ __
    #_ < |\| |< _#

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Computer Nerd Kev@21:1/5 to Eli the Bearded on Sat Jan 14 02:13:51 2017
    XPost: comp.os.linux.misc

    In comp.os.linux.misc Eli the Bearded <*@eli.users.panix.com> wrote:
    In comp.mail.misc, Computer Nerd Kev <not@telling.you.invalid> wrote:

    I'm a bit confused about "mail" as far as remote server access
    goes, and I've noted that writing a custom program or
    script to send the few required IMAP commands directly
    might not be all that difficult.

    Looks very straight forward in IMAP.

    https://tools.ietf.org/html/rfc3501

    Look at the "EXAMINE" command.

    Thanks, I have had a quick look. "EXAMINE" actually appears only
    to return the number of the first unread message. I cheated and
    looked in the log for my Email client to find it used the
    "STATUS" command which can return "UNSEEN - The number of messages
    which do not have the \Seen flag set."

    I almost decided to go ahead and do it this way, but figured
    I'd check whether I was reinventing the wheel. Especially as
    setting up scripts or (cross)compiling software isn't quite
    as easy with the limited OpenWrt embedded OS. At least for
    someone who isn't used to it.

    --
    __ __
    #_ < |\| |< _#

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Eli the Bearded@21:1/5 to Computer Nerd Kev on Sat Jan 14 00:34:21 2017
    XPost: comp.os.linux.misc

    In comp.mail.misc, Computer Nerd Kev <not@telling.you.invalid> wrote:
    To this end I've been trying to find a Linux command line
    utility (preferably included with, or available in a package
    for, OpenWrt) to simply return the number of unread emails
    in a specified Email inbox.

    I'll let someone else address this bit.

    I'm a bit confused about "mail" as far as remote server access
    goes, and I've noted that writing a custom program or
    script to send the few required IMAP commands directly
    might not be all that difficult.

    Looks very straight forward in IMAP.

    https://tools.ietf.org/html/rfc3501

    Look at the "EXAMINE" command.

    Elijah
    ------
    wrap with "openssl s_client" if needed

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Allodoxaphobia@21:1/5 to Computer Nerd Kev on Sun Jan 15 01:39:36 2017
    XPost: comp.os.linux.misc

    On Fri, 13 Jan 2017 23:35:21 +0000 (UTC), Computer Nerd Kev wrote:

    To this end I've been trying to find a Linux command line
    utility (preferably included with, or available in a package
    for, OpenWrt) to simply return the number of unread emails
    in a specified Email inbox.

    Local "Email inbox", or remote (imap)?

    Don't laugh, but I use `nfrm` (in a bash script) from the elm
    package to count (new/unread in my case) messages in my myriad
    of email folders.

    https://ts3.easyco.net/easydocs/linux/man/man1/frm.htm

    I use _nothing_ else from the elm package.
    In fact, I copy nfrm to $HOME/bin/ and uninstall elm. heh...

    Ahh.. Reading further I see it's a remote email server.
    So, this is probably just more wasted electrons.

    Jonesy
    --
    Marvin L Jones | Marvin | W3DHJ.net | linux
    38.238N 104.547W | @ jonz.net | Jonesy | FreeBSD
    * Killfiling google & XXXXbanter.com: jonz.net/ng.htm

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Lew Pitcher@21:1/5 to not@telling.you.invalid on Sat Jan 14 23:30:47 2017
    XPost: comp.os.linux.misc

    On Friday January 13 2017 18:35, in comp.os.linux.misc, "Computer Nerd Kev" <not@telling.you.invalid> wrote:

    I'm looking at building a little display for my unread emails
    and internet data usage, to be connected to my router running
    the OpenWrt firmware. I want to determine the software options
    before starting on the electronics.

    To this end I've been trying to find a Linux command line
    utility (preferably included with, or available in a package
    for, OpenWrt) to simply return the number of unread emails
    in a specified Email inbox. Even more ideal would be the
    inclusion of some obscuration of the password used to access
    the Email account (in other words to not have it stored in
    plain-text on the router).

    The Email server supports IMAP and POP. But I want to read
    the emails directly from the server (not download them to the
    router and access them locally), so I believe that IMAP
    would be the preferred system for remotely accessing a
    count of unread messages.

    So far I've ruled out "nmh" due to apparant lack of IMAP
    support (at least to the degree required here), I'm a
    bit confused about "mail" as far as remote server access
    goes, and I've noted that writing a custom program or
    script to send the few required IMAP commands directly
    might not be all that difficult.

    A quick Google search finds
    http://jpmens.net/2009/04/26/a-bifferent-kind-of-e-mail-notifier/
    which is someone else's attempt at finding out if they have pending email.
    They use an arduino as their notification mechanism (where you would use whatever it is that you are developing), and a Perl script to connect to the IMAP server and poll it for unread messages. Perhaps you can customize this Perl program, or use it as a model for the code/device you have in mind.

    HTH
    --
    Lew Pitcher
    "In Skills, We Trust"
    PGP public key available upon request

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)