Get count of unread mails

Hi there!
Is there a way to get the count of unread mails (of Leopard Mail) via terminal? (Without using osascript/Applescript.) By reading out some XML file or sort of?
TIA

Thanks jpimbert! Well, sadly this doesn't work. And I think it's not sql related. It' Mail related as Mail doesn't count the unread mails correctly. Example: no unread mails in the "general" inbox, but one in an online folder, that appears in the inbox as read at the same time. I use gmail and my own imap server. Both show them up in the same way. So it has nothing to do with gmail either.
Those ghostly unread mails don't appear anywhere in Mail unless you create a smart folder showing "only unread mails". The former sql command shows them, too.
So, can the sql statement by modified in a way that it only reflects local unread mails? (Therefore unaware that they might be IMAP.)

Similar Messages

  • Can't get rid of unread mail icon--shows 2 unread messages but can't find any

    I've got a smart mailbox that shows unread messages so I can easily see what new and unread mail I have.  The problem is it gives me the notification icon that indicates I have two unread messages, yet the mailbox does not show any messages as unread...  This isn't a huge problem, but the Mail icon in my dock always shows that I have new mail, and the notification icon is small enough that I can't always clearly see if it's the "usual 2" or a higher number.  What could be causing this and how do I either find the unread messages or get this icon reduced to where it only shows me REAL unread messages?
    Rocketman

    Quit Mail. Force quit if necessary.
    Back up all data. That means you know you can restore the Mail database, no matter what happens.
    Triple-click anywhere in the line below on this page to select it:
    ~/Library/Mail/V2/MailData
    Copy the selected text to the Clipboard by pressing the key combination command-C. In the Finder, select
    Go ▹ Go to Folder
    from the menu bar. Paste into the box that opens (command-V), then press return.
    A folder window will open. Inside it there should be files with names as follows:
    Envelope Index
    ExternalUpdates.storedata
    Move those files to the Desktop, leaving the window open. Other files in the folder may have longer names that begin as above. Move those files, if any, to the Trash.
    Log out and log back in. Relaunch Mail. It should prompt you to re-import your messages. You may get a warning that the index is damaged and that Mail has to quit. Click OK. Typically, the process takes a few minutes, but it may take hours if you have gigantic mailboxes. In that case, you may be able to speed things up by temporarily adding your home folder to the Privacy list in the Spotlight preference pane. Remove it when Mail has finished importing.
    Test. If Mail now works as expected, you can delete the files you moved to the Desktop. Otherwise, post your results.

  • Is there a way to make Mail app badge to show the count of unread mail for only certain account?

    The mail app badge normally shows the total count of unread emails in all your accounts.  Is there a way to set it so that it only displays the count from one specific mail account?

    No.
    http://manuals.info.apple.com/en_US/iphone_user_guide.pdf    WYSIWYG

  • User unread mail count attribute

    is there any attribute in Exchange 2010 we can use in EMC to know the count of unread mails in a single mailbox?

    Hi,
    Based on my knowledge, we can't get user's unread information from EMC. But we can get it using EMS. For the unread count, you can use the following scripts to get it.
    $mbcombCollection = @()
    $specificuser = get-mailbox -identity <INSERT USER ALIAS HERE>
        $mbcomb = "" | select DisplayName,EmailAddress,Unread
        $mbcomb.DisplayName = $specificuser.DisplayName.ToString()
        $mbcomb.EmailAddress = $specificuser.WindowsEmailAddress.ToString()
        $mbMailboxEmail = $specificuser.WindowsEmailAddress.ToString()
        "Mailbox : " + $mbMailboxEmail
        $ewc = new-object EWSUtil.EWSConnection($mbMailboxEmail,$false, $null,$null,$null,$null)
        $dTypeFld = new-object EWSUtil.EWS.DistinguishedFolderIdType
        $dTypeFld.Id = [EWSUtil.EWS.DistinguishedFolderIdNameType]::inbox
        $mbMailbox = new-object EWSUtil.EWS.EmailAddressType
        $mbMailbox.EmailAddress = $mbMailboxEmail
        $dTypeFld.Mailbox = $mbMailbox
        $fldarry = new-object EWSUtil.EWS.BaseFolderIdType[] 1
        $fldarry[0] = $dTypeFld
        $fldList = $ewc.GetFolder($fldarry)
        [EWSUtil.EWS.FolderType]$pfld = [EWSUtil.EWS.FolderType]$fldList[0];
            $mbcomb.Unread = $pfld.UnreadCount
        $mbcombCollection += $mbcomb
    $mbcombCollection
    For more information, here is a similar thread for your reference.
    Getting Unread item count for a single user
    https://social.technet.microsoft.com/Forums/en-US/2cc23209-4e8d-43bd-bc93-71b3439d7401/getting-unread-item-count-for-a-single-user?forum=exchangesvradminlegacy
    Hope this can be helpful to you.
    Best regards,
    Amy Wang
    TechNet Community Support

  • Mac Mail: Unread mail counter on dock icon shows "phantom" unread mails

    The mailconter of my Mac Mail icon on the dock shows 25 unread messages, but I'm unable to find these inside Mac Mail as unread messages.
    I did check all mailboxes and their subfolders for any undread messages that might be inside them, but I didn't find any.
    Is there any way to reset or recalculate the unread mail counter for the dock icon?

    Hi Robert
    The proposed rebuild did suddenly reveal the 25 unread mails insinde my archive mailfolders. By marking these as read again now shows the correct count of unread mails on the dock icon.
    Thanks a lot, your hint was most helpful!
    Regards
    Erich

  • How to include the exchange sub folder's unread mail into the "UNREAD" group in default exchange mail app in iPhone ?

    I am using ios 7.0.2. I have many sub folders in my exchange mail box. Problem is when any mail comes to the sub folder, it is not counted as unread mail and it also does not be visible under the unread mail group. The unread mail group only shows the unread mails which have come directly to inbox but not the mails which comes to the sub folder according to the set rule. Have any one noticed this ridiculous thing? Is there any solution or it's a bug??

    I have the same problem. On the IPad and IPhone I can easilly connect to our Exchange server. When setting up a MacBook Air, using the same settings (account/server address etc) it doesn't work...
    Does anyone have a solution for this?
    Thanks!
    Sander

  • HT6030 Unread mail count still doesn't work for any mail accounts after installing the Nov. 7 Mail fix. I deleted Gmail from my Mac Mail so that's not the problem.

    I still cannot get an Unread Mail count in the Dock even after installing the the Nov. 7 Mavericks update. I deleted my Gmail account from my Mac, so I know that's not a problem. I checked the Mail preferences, and thay is configured correctly. Any suggestions?

    Point noted re multiples posts [ there were loads of  typos in previous]   . Your previous reply  may indeed be one way of  solving my problem. Thanks .
    Nevetheless  why does Apple prodcue "updated " software which isnt properly comptiable or tested;  with the result that it   now  doesnt work well with Gmail when the prevoius version worked fine. You would think an update  would at least work with Gmail as  well as the prevsoius version did.  G mail is  very widely used, so they, Apple,  and probably  Google too are  shooting themselves in the foot if they can't make the software compitable,

  • Unread Mail Count

    Is it possible to have an application read an unread mail count (in the menu bar, etc.) while the actual Mail app is not active?

    You can get that via AppleScript:
    tell application "Mail"
    set theCount to unread count of mailbox "Junk"
    end tell
    This will tell you how many unread Junk emails you have. Substitute any other mailbox name.

  • Mail - Unread Mail Count corrupted

    I have set up a Smart Mailbox in Mail to hold all of my unread mail until I have a chance to deal with it.  It is called "Unread" and the condition for the box is simply all messages that match the condition "Message is Unread"
    There are currently 15 messages in this Smart Mailbox, yet the count at the side of the Mailbox list indicates 1197, and when I click on that Mailbox the title across the top of Mail indicates "Unread (15 messages, 1197 unread)".
    Clearly that unread count has been corrupted some way ... is there any way to reset it?
    Many thanks to anyone who can help!
    OS X 10.9 [Mavericks] Build 13A693 | Mail Version 7.0 (1816)

    Not entirely te same thing but after upgrading to 10.9 my Gmail item count in my "Inboxes" is continually set at "1" eventhough there are no unread messages.  I have also gone to gmail via the web app and it shows no unread messages.  So something is assuredly wacky.

  • How can I show unread mail count of Gmail,Yahoo,AOL in my web application.

    I want to show unread mail count for Gmail,Yahoo,AOL,MSN (e.g. Gmail (5) ) on my web application. Also when user click on unread mail count it should open new window for respective mail Inbox say gmail inbox that shows unread mail of user.
    I have exercised on jgmail source code & it has used HttpClient API to login into gmail and access services of gmail but I am not able to execute it successfully.
    what are the options for above questions?
    Thanks In Advance
    Ankit Patel
    Edited by: ankit.patel on Aug 14, 2008 7:10 AM

    JavaMail supports two standard protocols for reading mail POP3 and IMAP.
    As explained in the JavaMail FAQ (you found it, right?), the POP3 protocol
    doesn't provide information on unread messages.
    As far as I know, only Gmail supports IMAP. I don't believe either AOL or MSN
    support even POP3, but I'm not sure.

  • Unread mail count in the dock

    I only see the unread mail count (red circle rigth side of postage stamp icon) in the dock when the mail program is open...
    open mail...it appears...close mail..it disappears...
    is this the way it is suppose to work (doesnt seem very useful, e.g. it does not alert me to unread mail)
    thx

    i mean the counter on the postage stamp icon in the dock...
    this counter---mail closed
    now with mail open
    with mail open i do not need this counter...mail is open...i can see how many unread i have...its when i have mail closed that i want to see emails come in..

  • Unread Mail Count wrong after Time Machine restore

    I, and others on this forum seem to have an unsolved issue having restored from Time Machine backup, so presumably a glitch somewhere in the restore system.
    We have followed the normal advice of rebuilding mailboxes, but it doesn't help.
    Does anyone have an answer to how to reset the unread mail count to zero other than trash all the accounts and manually 'rebuild'
    Thanks
    Stephen

    Hi,
    I cannot take credit for this solution - I found the answer to this by searching through the Mail discussion forums. Another user had 3 emails that he had read, but they were still showing up in his Mail Badge Counter and this is how he fixed it.
    The super-simple-solution:
    Create a "Smart Mailbox" and set it to only contain all unread mail messages. This will grab all of the emails that Mail "thinks" are unread and is marking as such in the badge counter. Select all the emails, mark as read... and you're good to go.
    Hope this helps.

  • Ios 7 unread mail message count wrong

    The unread mail count always indicates unread mail even though all the mail has been read.
    This is happening on my iphone 4 ios 7. Does not happen on the same account using MTL mail (10.8.5).
    I have tried deleting my envelop index, rebuilding mailboxs, synchronizing mail on my mac. Also removing & reinstalling  mailbox from iphone.
    Still there. Its my yahoo account using pop mail. Always worked before updating to ios 7.
    thanks
    jeff

    Go to Mail inbox, select edit from top right, click Mark all, then Mark as read.  Should clear it up

  • Bogus Unread Mail Count?

    Hi,
    I did a synch this morning and seem to have buggered the 'unread' mail count
    that badges the Phone Icon.
    I also upgraded to OSX 10.5.7...
    It asserts that there are 11 unread messages but I cannot find any...
    How can I clear the incorrect mail count?
    Thanks
    Jerry

    I figured it out...
    I think when I did the sync it added a new mail
    account that I had created on my mac for tracking
    my wifes medical correspondence...
    The badge count matched the number of unread mails in
    the new account.
    Jerry

  • Total unread mail count display

    I believe the iPhone/ios 6.1.4 displays only the total number of unread emails in the top level of the inbox. But I have rules that move unread mail to multiple subfolders, and I'd love to be able to have a total count of unread items in the inbox and all subfolders. I use a smart mailbox to do this on the iMac, but the absence of smart mailboxes means that I'm often unaware of unread items in subfolders when I only have access to my iPhone and iPad. I'd appreciate any thoughts.

    Fact is, the iOS mail app is not as sophisticated as the mail app on your Mac, & local rules are not synced to your phone. There is no fix.
    All you can do is suggest an enhancement to Apple:
    http://www.apple.com/feedback/iphone.html

Maybe you are looking for