Jump to content

Own Outlook rules


Iversen
 Share

Recommended Posts

Hi,

we are using Synology NAS with Zaraf Mail Server.
User mail address look like john.doe@domain.com und this is the default sender address for the user.
The user have the right to send as info@domain.com and can switch to this address in Outlook. If the user send with info@domain.com the sent mails stored in the "Sent Items" folder of the user. We habe a public Folder in which all mails send as info@domain.com must stored. Outlook own rules dont work. Most of this rules are not supporttet by Zarafa.

Now i want to create an autoit script which move mails send as info@domain.com to a spezial folder.



Here my Idea with Unread mails. In dont know what to change to work with mails "send as"

 

; Include Functions
#include <OutlookEX.au3>
 
; Connect to Outlook
Global $oOutlook = _OL_Open()
If @error <> 0 Then Exit MsgBox(16, "Connect to Outlook", "Error connecting to Outlook. @error = " & @error & ", @extended = " & @extended)
 
; Access correct mailbox
Global $aFolder = _OL_FolderAccess($oOutlook, "john.doe@domain.com\Posteingang\Test", $olFolderInbox)
If @error <> 0 Then Exit MsgBox(16, "Folder access", "Error accessing the mailbox. @error = " & @error & ", @extended = " & @extended)
 
; Get unread items
Global $aItems = _OL_ItemFind($oOutlook, $aFolder[1], $olMail, "[Unread]=True", "", "", "EntryID,Subject,Body")
If @error <> 0 Then Exit MsgBox(16, "Item find", "Error searching for unread mail items. @error = " & @error & ", @extended = " & @extended)
;    If IsArray($aItems) Then _ArrayDisplay($aItems)
MsgBox(0, "Number of unread items", $aItems[0][0])
If $aItems[0][0] = 0 Then Exit MsgBox(16, "Error", "No mail items in Correct Mailbox Inbox.")
  
  
; _OL_ItemDisplay($oOutlook, $aItems[1][0])
  
_OL_ItemMove($oOutlook, $aItems[1][0], Default, "john.doe@domain.com\Posteingang\testneu")

_OL_Close($oOutlook)

thx 4 your help

Link to comment
Share on other sites

Check property SentOnBehalfOfName.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Should be

Global $aItems = _OL_ItemFind($oOutlook, $aFolder[1], $olMail, '[SentOnBehalfOfName] = "Info"', "", "", "EntryID,Subject,Body")

but at the moment I can't test either.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...