Forum Discussion
a reminder for replying specific emails - Printable Version

+- Forum Discussion (http://forum-discussion.com)
+-- Forum: IT Forum (http://forum-discussion.com/Forum-IT-Forum)
+--- Forum: Computer Software (http://forum-discussion.com/Forum-Computer-Software)
+--- Thread: a reminder for replying specific emails (/Thread-a-reminder-for-replying-specific-emails)



a reminder for replying specific emails - Tlasuter - 06-05-2017

Hi ,

Recently I find that I may forget to reply some emails when I close my outlook. Some of them are very important to me and should be replied that day.

Outlook will remind me when some emails are not sended successfully when I close the outlook. I wonder if there is also a way that I can get a reminder to reply specific emails when I close outlook. Any ideas? It's about office2010


RE: a reminder for replying specific emails - Sleuya - 06-08-2017

Hello,

For that case, you may use a macro to do that. Try the codes below

Private Sub Application_Quit()
   Dim objInboxFolder As Outlook.Folder
   Dim objMail As Outlook.MailItem
   Dim i, n As Long
   Dim objPropertyAccessor As Outlook.propertyAccessor
   Dim strRepliedStatus As String
   Dim nDateDiff As Integer
   Dim strMailList As String
   Dim strMsg As String
   Dim nWarning As Integer

   Set objInboxFolder = Outlook.Application.Session.GetDefaultFolder(olFolderInbox)

   n = 0
   For i = objInboxFolder.Items.Count To 1 Step -1
       Set objMail = objInboxFolder.Items.Item(i)

       DoEvents
       If TypeOf objMail Is MailItem Then
          'Set the criteria for important emails as per your needs
          'Such as from specific sender or subject containing specific words
          If objMail.SenderEmailAddress = "boss@datanumen.com" And InStr(LCase(objMail.Subject), "datanumen") > 0 Then

             'Check if the email is replied or not
             Set objPropertyAccessor = objMail.propertyAccessor
             strRepliedStatus = objPropertyAccessor.GetProperty("http://schemas.microsoft.com/mapi/proptag/0x10810003")
             If (Not (strRepliedStatus = 102)) And (Not (strRepliedStatus = 103)) Then

                'Only work for the recent incoming emails
                'Received within 12 hours
                nDateDiff = DateDiff("h", objMail.ReceivedTime, Now)
                If nDateDiff < 12 Then
                   n = n + 1
                   strMailList = strMailList & n & ". " & objMail.Subject & vbCrLf
                   strMsg = "You may forget to reply some important emails, as follows:" & vbCrLf & vbCrLf & strMailList & vbCrLf & "You had better restart your Outlook to reply them!"
                End If
             End If
         End If
      End If
   Next

   If strMailList <> "" Then
      nWarning = MsgBox(strMsg, vbExclamation + vbOKOnly, "Outlook Warning")
   End If
End Sub

You can find more details here

datanumen.com/blogs/get-warned-forgetting-reply-important-emails-closing-outlook/

Good luck