Gossamer Forum
Home : Products : Gossamer Mail : Discussion :

Storing number of new messages in MySQL

Quote Reply
Storing number of new messages in MySQL
Here is what we would like to see happen:

When incoming.pl goes to retrieve email, it ends up with a certain number of new messages for all users (0 and above)

We would like to have the number of new email messages added in mysql table...Meaning we can add a field in users table, say 'New', and incoming.pl would write there the number of new messages it has just retrieved for that user.

When incoming.pl runs again, it adds the number of new messages now received,...

When a certain user goes to his inbox, the number of new email messages is reset to zero.

And so on....

Thanks

Frank


Quote Reply
Re: [frankLo] Storing number of new messages in MySQL In reply to
Hi,

So you are looking for a difference between number of new and number of unread? Hmm, we'll look at how easy this is to put in.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Storing number of new messages in MySQL In reply to
Hello Alex,

Thank you for taking the time to reply.

I think there is a difference between new messages and unread messages. For example, in my yahoo account right now there are 66 unread messages but none is new.

What we really want to be able to do, is to query the number of new messages that user got since last login. Having this info in a mysql table will give us a lot of flexibility for some miscellaneous functions we want to implement.

To my mind, incoming.pl knows how many new messages are coming for each user and so storing that in mysql should be trivial. Here we are not looking at unread messages already in user mailbox.

So each time incoming.pl runs, it updates the 'new messages' mysql data for each user. Then when a user logs in, the number corresponding to each user is reset to zero. This again has no relationship to number of unread messages.

So really it's all about some new functionality that appears to be simple to implement and that is completely unrelated to any functionality currently implemented.

I would really appreciate any help in that respect

Frank
Quote Reply
Re: [frankLo] Storing number of new messages in MySQL In reply to
Hi,

The information is there, just not to easy to use. On MySQL you can run:

Code:
SELECT COUNT(*)
FROM gmail_msgtrack, gmail_msgs, gmail_users
WHERE msgtrack_mid = msgs_id AND
msgtrack_userid = userid AND
UNIXTIMESTAMP(msgs_sent) > users_last_login AND
email = 'ACCOUNT@DOMAIN.COM'

This will return a list of all messages that have come in since the user last logged in. All you need to do is replace ACCOUNT@DOMAIN.COM with the email of the user you want to check. If you are on 2.0.5 or less, you should replace email =, with user =.

Hope that helps,

Alex

--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Storing number of new messages in MySQL In reply to
Hi Alex,

Thank you so much for the tip. It works like a charm.

Thanks again

Frank