Avatar of jennifer_merritt
jennifer_merrittFlag for United States of America

asked on 

Query Lotus Notes for number of Unread Mail in URL or Data Dump.

I need to display the number of unread emails a user has on a web page.

We have all see the Link for mail and then a (4) behind it meaning there are 4 unread emails in the account.

The email server is lotus. Is there a way i could provide the username and password from the user to a lotus database and get the number of unread emails back? Maybe in a url?

Another option would be to query lotus database every couple of minutes and dump the data into an sql database that i would then query with the web page. For instance, could i creat a table from lotus that lists the username along with the number of unread messages? If so i could make the web page query this table.
Lotus IBMEmail Servers

Avatar of undefined
Last Comment
Sjef Bosman
Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

Seems a rather crude approach to me: dump a database, create a table, etc. Did you know that a Domino server is a web server, so why all the indirect queries? Develop your web pages in Domino, I'd say. And why don't you use iNotes??

What Domino release is the server?
Avatar of jennifer_merritt

ASKER

I am running 8.5 domino.
I just need a page that will display one number...the number of unread emails. I just need to get this number and then i can complete the other page that i need to create.

The page shows a couple of application links with the number of actions that need to be taken....ie:

You have (4) unread emails.
You have (24) documents to sign.
You have (1) deficiency.

I would like to be able to pass a username and then get back the email number.
Avatar of jennifer_merritt

ASKER

I am using inotes actually. the link is to inotes. but i need to show them how many unread emails they have on the link...if that makes any sence?
 
The link to inotes is single sign on.
Avatar of Bill-Hanson
Bill-Hanson
Flag of United States of America image

It sounds like you're making a dashboard.

Although there is no simple URL command that will return the unread count for a specific user, you can create a web service (or just a simple agent) that can return this info to your page using AJAX.

Here's an example of a simple agent that can be called via AJAX. Just remember that unread marks are stored per user, so the code that makes this AJAX call needs to be run as the logged in user.

Dim session As New NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim vc As NotesViewEntryCollection
Set db = session.CurrentDatabase
Set view = db.GetView("($Inbox)")
Set vc = view.GetAllUnreadEntries()
Print vc.Count

Open in new window

Avatar of jennifer_merritt

ASKER

is there a way that i could pass the username and be returned a number of unread mails? This has to happen on a web page. I could use an iframe.
I don't want to authenticate each user to get this one number.

Is there a way that i could use my crude way of getting this information? Can i get a dump from lotus showing a username and a number of unread emails. If i could get that dumped every couple of minutes, i would be able to query that table.

Does lotus domino provide a scheduled task that would allow it to be queried by a SQL server by chance?

I know it is not a nice idea, but it is the only solution i see that would not involve logging in a user in order to get one number(being the unread emails).
Avatar of Bill-Hanson
Bill-Hanson
Flag of United States of America image

The only problem you have is that the user must be authenticated.  I know of no other workaround.  Once the user is authenticated, then retrieving the count is trivial.
Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

Agreed, 100%. Some explanation: the unread count is per person, so if someone else would check my mail database he'd get a different number.
Avatar of jennifer_merritt

ASKER

Could i explore the possibility of outputting a table (in some format) that will show each users username and the number of unread emails?
Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

AFAIK not possible.
Avatar of Bill-Hanson
Bill-Hanson
Flag of United States of America image

Not possible unless you had all user names and password stored un-encrypted on the server.  Then you might be able to use HTTP POST to authenticate the user programatically and retrieve the count.  Of course, then you have the problem of storing, maintaining and securing a database that might present a security vulnerability.  Again, there's no way to get the count without authenticating the user.
Avatar of jennifer_merritt

ASKER

How would i go about authenticating the user and retrieving the number. I know how to authenticate via a http-post. But what would i do after authenticating in order to get the number back?
Avatar of Bill-Hanson
Bill-Hanson
Flag of United States of America image

You would redirect to the agent or web service that returns the count.

The code is posted above (#36932149).  Place it in an agent that runs as the web user (security tab of agent properties).  If you use this agent as is, you will need to place it in each user's mail file.  Another option is to put the agent in a central location, and open the current user's email explicitly.
ASKER CERTIFIED SOLUTION
Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

Or he code above ... :$
Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

Eh? Does that work indeed??
Avatar of jennifer_merritt

ASKER

I haven't tried it, but have decided to reach out to a consultant to assist with this project. I hope to get a resolution that way.

Thank you for all your help.
Avatar of Bill-Hanson
Bill-Hanson
Flag of United States of America image

RE:"Eh? Does that work indeed??"

Yep!  Anything printed in a web agent gets sent back to the browser.  This is how I provided web services in Domino before Lotus officially supported it.  I use this technique often to generate dynamic content for web apps at run time.  For the agent above, all you would need to do is check the value of responseText.  The only hard part about this question is the authentication.
Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

Eh, Bill, that question was for Jennifer, regarding my suggestion to use an Outline in a Page. I was (and am still) rather surprised to be the sole beneficiary of the points awarded in this question, which seems not entirely fair to me.

@JM: maybe it's a suggestion to have the question reopened, and then we wait till you can publish the hired consultant's advice, so you can rightfully (re)award the points.
Avatar of Bill-Hanson
Bill-Hanson
Flag of United States of America image

RE:"rather surprised"

Me too, but no worries.  As I've said many times, I don't do this for the points. In this case, the question is marked as answered with a 'Good' rating, but the answer is untested, still requires the user to authenticate, and will perform slower than my solution. Such is life.  ;)
Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

No worries here, just amazed, and uncomfortable with the wrongly attributed credits (not points).
Avatar of jennifer_merritt

ASKER

I am not quite sure how to unclose a question. I wasn't expecting to have a discussion about points. Just thought some posts were more inline with what i wanted to do.
Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

No problem, it is not really a points discussion. I was just wondering whether the best answer to your question was indeed the one you accepted, for Bill's code does a similar thing in a more modern and definitely shorter way. It's all up to you!
Email Servers
Email Servers

Within Internet message handling services (MHS), a message transfer agent or mail transfer agent (MTA) or mail relay is software that transfers electronic mail messages from one computer to another using a client–server application architecture. A MTA implements both the client (sending) and server (receiving) portions of the Simple Mail Transfer Protocol (SMTP). The terms mail server, mail exchanger, and MX host may also refer to a computer performing the MTA function. The Domain Name System (DNS) associates a mail server to a domain with mail exchanger (MX) resource records containing the domain name of a host providing MTA services.

27K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo