I'm looking for an outlook macro, that sends out auto acknowledgement emails for new mails received to a specific shared inbox. (Should not auto acknowledge for reply and fwd message), and not sure how to exclude the reply and fwd mails. Below code Is not working. Please advise.
Public WithEvents xlItems As Outlook.Items Private Sub Application_Startup() Set xlItems = Session.GetDefaultFolder("firstname.lastname@example.org").Folders("On going").items End Sub Private Sub xlItems_ItemAdd(ByVal objItem As Object) Dim xlReply As MailItem Dim xStr As String If objItem.Class <> olMail Then Exit Sub Set xlReply = objItem.Reply With xlReply xStr = "<p>" & "Hi Team, Acknowledging that we have received the Job. Thank you!" & "</p>" .HTMLBody = xStr & .HTMLBody .Send End With End Sub