How to display number of e-mails on OpenHab 1.8.3?

Hi everybody I’ve just created an item called “Mailbox” like above, is there any method to get the number of e-mails from my g-mail account and display it on openhab UI?
Can you show me?

You could use the exec binding to repeatedly run a shell script that prints the number. This describes one way to find the number of messages in your inbox. You could automate it by redirecting in “tag” IMAP commands instead of typing them. Then grep and parse the output in your shell script to isolate the number in the reply STATUS "INBOX" (MESSAGES 6388). The script will finally print just the number 6388. The exec binding, bound to a Number item, will then be updated to the state 6388. You would need to have some shell script and Unix skills to accomplish this.

Woah thanks for your reply.
I thought it was much more easier than you said at the first time. Now thanks for your help, my eyes are truly wide opened.
Since I am totally a newbie, I hope you could dedicatedly instruct me. I’m really enjoy study IT (I’m just a high school student) but I got so many difficult problems because you know…swimming by myself in a large pool is totally frustrating !

Normally there would be a binding (a component written in Java) that takes simple configuration information and performs all the steps needed to achieve the results you’re after. I do remember seeing a “mailcontrol binding” some time ago but I recall it was difficult to configure and use, and might not address your use case.

There might be a reason to write an “IMAP binding” that gives visibility to information in mailboxes, such as number of messages, filters that trigger events if message subjects or contents contain a certain string, parse out specific bits of information, etc.

I’m not able to provide you guidance on how to follow my earlier suggestions, but I think it would be a good learning exercise for you to try writing scripts that interact with the IMAP protocol, just to see what kind or results you get. I know it’s a steep learning curve, but it can be fun to learn by solving problems, and you will come away with valuable technical knowledge you can use again! Once you have a script that only outputs the information you’re looking for, it can then be integrated into openHAB as a source for item states using the exec binding.

All the best,