Iversen

Own Outlook rules

4 posts in this topic

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

Share this post


Link to post
Share on other sites



Check property SentOnBehalfOfName.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Check property SentOnBehalfOfName.

 so i can use SentOnBehalfOfName like
 

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

?

i have no outlook on this PC to test it. I can test it next week at work.

 

thx

 

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

 

Share this post


Link to post
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