Can I "Move to IMAP folder" in OnDeliverMessage?

Use this forum if you have installed hMailServer and want to ask a question related to a production release of hMailServer. Before posting, please read the troubleshooting guide. A large part of all reported issues are already described in detail here.
Post Reply
rstarkov
New user
New user
Posts: 26
Joined: 2013-12-30 15:51

Can I "Move to IMAP folder" in OnDeliverMessage?

Post by rstarkov » 2014-02-16 20:28

I've been running into limitations of Rules for a while now, mostly the inability to write proper boolean conditions, like "A & (B | C | D)". I've always thought I will eventually just use scripting for this. Now that I've given it a go, however, it appears that I can't: OnDeliverMessage cannot move the message to an IMAP folder like a Rule can (although the last post I found to mention this was in 2008).

Another limitation is that I have some global rules that I want to run before all the account rules, then I want some per-account rules to run, and then some more global rules. Again, was hoping to fix this by using scripts.

Is it still the case that I cannot fully replicate the "Move to IMAP folder" action in a script?

percepts
Senior user
Senior user
Posts: 5282
Joined: 2009-10-20 16:33
Location: Sceptred Isle

Re: Can I "Move to IMAP folder" in OnDeliverMessage?

Post by percepts » 2014-02-17 05:16

REGEX is your friend.

rstarkov
New user
New user
Posts: 26
Joined: 2013-12-30 15:51

Re: Can I "Move to IMAP folder" in OnDeliverMessage?

Post by rstarkov » 2014-02-17 15:12

Not for the general case of "if (Header1 == A) && (Header2 == B || Header3 == C)". I did this once, by using multiple rules and setting an intermediate header value, but that is one unmaintainable mess of rules, so I was hoping to replace it all with a script.

Got my answer though. Thanks.

User avatar
mattg
Moderator
Moderator
Posts: 20103
Joined: 2007-06-14 05:12
Location: 'The Outback' Australia

Re: Can I "Move to IMAP folder" in OnDeliverMessage?

Post by mattg » 2014-02-17 15:40

It should be possible from a script

The complete Admin GUI is written using the COM API, so if it can be done using the Admin GUI, it can be done someway via the COM API.

I checked, I only use account or global level rules to move mail into public folders, I don't do it by script, but I feel sure that it should be possible.
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

Post Reply