question

DanielLeung-3677 avatar image
0 Votes"
DanielLeung-3677 asked FaeryFu-MSFT edited

schedule outlook forward incoming email

Hi all,

Do you know any software or VB script can forward all emails to other email address
For example, I want to forward all incoming email from 3pm to 5pm on Monday to Friday to abc@abc.com

office-outlook-itprooffice-vba-dev
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @DanielLeung-3677 ,

According to your description, seems that you are encountering issue about development, please kindly understand the tag” office-outlook-itpro” which mainly focus on general issues about Outlook client. In order to better resolve your problem, I will add the tag” office-vba-dev”, so that users of their forum can help to see it together

Thanks for your understanding and hope your issue would be resolved soon.

0 Votes 0 ·
eugene-astafiev avatar image
0 Votes"
eugene-astafiev answered

You can handle the NewMailEx event of the Application class in Outlook. The event is fired when a new message arrives in the Inbox and before client rule processing occurs. It fires once for every received item that is processed by Microsoft Outlook. The item can be one of several different item types, for example, MailItem, MeetingItem, or SharingItem. The EntryIDsCollection string contains the Entry ID that corresponds to that item. Call the NameSpace.GetItemFromID method and process the item.

In the NewMailEx event handler you may check all your conditions and forward the incoming email if required. The MailItem.Forward method executes the Forward action for an item and returns the resulting copy as a MailItem object. The following VBA sample code shows how to forward mail items:

 Sub RemoveAttachmentBeforeForwarding()
  Dim myinspector As Outlook.Inspector 
  Dim myItem As Outlook.MailItem 
  Dim myattachments As Outlook.Attachments
     
  Set myinspector = Application.ActiveInspector

  If Not TypeName(myinspector) = "Nothing" Then 
    Set myItem = myinspector.CurrentItem.Forward 
    Set myattachments = myItem.Attachments 
    While myattachments.Count > 0 
      myattachments.Remove 1 
    Wend 
    myItem.Display 
    myItem.Recipients.Add "Eugene Astafiev" 
    myItem.Send 
  Else 
    MsgBox "There is no active inspector." 
  End If 
 End Sub




5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

DanielLeung-3677 avatar image
0 Votes"
DanielLeung-3677 answered

Do you know any third party software can do the job?
The script doesn't seem to meet the condition that I want. If just forwarding, I can just use the rule on the outlook.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.