Check for new email in OutlookTag(s): WSH VBScript
Set otl = createobject("outlook.application") Set session = otl.getnamespace("mapi") session.logon Set inbox = session.getdefaultfolder(6) 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
Dim onMAPI As NameSpace Dim ofFolder As MAPIFolder Dim oItem As Object Dim omNewMail As MailItem Set oWSHShell = CreateObject("Wscript.shell") Set onMAPI = GetNamespace("MAPI") Set ofFolder = onMAPI.GetDefaultFolder(olFolderInbox) Set omNewMail = ofFolder.Items.GetFirst Ret = oWSHShell.PopUp("You have new mail from " & _ omNewMail.SenderName & _ " about " & omNewMail.Subject & "." & vbCrLf & _ "Would you like to read it now?", 5, _ "You have New Mail ", 65) If Ret = vbYes Then omNewMail.Display End If
mail_outline
Send comment, question or suggestion to howto@rgagnon.com
Send comment, question or suggestion to howto@rgagnon.com