Display new mail icon in Windows taskbar using VBScript

前端 未结 4 617
南方客
南方客 2021-01-05 14:10

I was having the hardest time configuring outlook to show the new mail message icon only when I wanted it to. I have several rules/filters set up that I didn\'t want to sho

4条回答
  •  执笔经年
    2021-01-05 14:41

    Create c:\scheduletools\mailcheck.vbs with the below content

    Set otl = createobject("outlook.application")
    Set session = otl.getnamespace("mapi")
    session.logon ''use parameters if required - see below
    ''session.Logon "myUsername", "password", False, False
    
    Set inbox = session.getdefaultfolder(6) '' 6 is for inbox
    c = 0
    For Each m In inbox.items
      If m.unread Then c = c + 1
    Next
    session.logoff
    s = "s"
    If c = 1 Then s = ""
    Msgbox "You have " & c & " unread message" & s
    

    one way to automatically run this is via task scheduler

    (start -> run -> (type)tasks -> enter)
    

    you can specify multiple schedules. A VB script file can run directly from Windows task schedule. In the task scheduler, select Add a new scheduled task. Following the prompts, browse to select your .vbs file. Name your task and select your schedule to run the task daily and select the time of day to run. It works just the same as if you want to schedule .Bat file.

    Use the absolute file path in the command.

    or create a .bat file calling your vbs file

    cscript //nologo c:\schedulttools\mailcheck.vbs
    

    please note if you have exchange level rules to move your mail to different folders, then you will need to look up all these folders for new mail.

    hope this help

提交回复
热议问题