Mirror account settings

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
gruenie
Senior user
Senior user
Posts: 299
Joined: 2004-01-23 03:25
Location: Germany, Halle

Mirror account settings

Post by gruenie » 2018-11-20 10:54

The mirror-account often is a useful feature.
Does anyone know whether or how it is possible to set different mirror-accounts per domain?
Alternatively: Is it possible to include/exclude domains from mirroring?

Thank you in advance for ideas. ;-)
Errare humanum est, sed in errare perseverare diabolicum!

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

Re: Mirror account settings

Post by mattg » 2018-11-20 17:16

to exclude a domain from mirroring you could use an account rule and drop the message

Domain by domain mirroring could be done with global rules (and or scripts)

Can only have a single mirror per hmailserver sorry - also be aware that this may be illegal in your jurisdiction so be careful
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

gruenie
Senior user
Senior user
Posts: 299
Joined: 2004-01-23 03:25
Location: Germany, Halle

Re: Mirror account settings

Post by gruenie » 2018-11-20 17:59

Thank you for the fast reply and the advice, dear Matt.

With "account rule" you probably mean a ruleset for the mirror-account.
I thought about that before but it is not that easy to catch all cases, because you need to include the from-, to-, cc-fields and the there are also cases, where you have just bcc-matches.
Or do you have an easier idea? 8-)
Errare humanum est, sed in errare perseverare diabolicum!

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

Re: Mirror account settings

Post by mattg » 2018-11-20 18:20

Account rule

Recipient list not includes '@example.com'
Action
Delete mail
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

gruenie
Senior user
Senior user
Posts: 299
Joined: 2004-01-23 03:25
Location: Germany, Halle

Re: Mirror account settings

Post by gruenie » 2018-11-20 18:31

Thank you.
But the recipient list does not comtain the sender, does it?
The mirror collects all incoming and outgoing messages, so we need at least a second rule. Or am I wrong?
Errare humanum est, sed in errare perseverare diabolicum!

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

Re: Mirror account settings

Post by mattg » 2018-11-20 23:33

Yes you you need two rules, one for sender, one for recipient

What I showed above is for all recipients, including those via BCC
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

gruenie
Senior user
Senior user
Posts: 299
Joined: 2004-01-23 03:25
Location: Germany, Halle

Re: Mirror account settings

Post by gruenie » 2018-11-21 00:02

Hi Matt,

for the recipient part you wrote:
"Recipient list not includes '@example.com'"

but there is no "not includes". And why "not"?
Shouldn't it be:
"Recipient list contains '@example.'"?

I created a rule:
- from not contains '@example.' AND
- recipient list contains '@example.'
= move to IMAP-Folder xxx (just for testing).

Then I sent en email to xxx@example.com.
... but the email wasn't moved!

When I created 2 rules:
- from not contains '@example.' AND
- recipient list contains '@example.'
= move to IMAP-Folder xxx (just for testing)

and:
- from not contains '@example.' AND
- to contains '@example.'
= move to IMAP-Folder xxx (just for testing)

... then it works.
Is "to" not part of "recipient list"?
Errare humanum est, sed in errare perseverare diabolicum!

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

Re: Mirror account settings

Post by mattg » 2018-11-21 00:25

Are you doing account level rules or global level rules?
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

gruenie
Senior user
Senior user
Posts: 299
Joined: 2004-01-23 03:25
Location: Germany, Halle

Re: Mirror account settings

Post by gruenie » 2018-11-21 00:34

As you have told me I did it inside the mirror-account.
Errare humanum est, sed in errare perseverare diabolicum!

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

Re: Mirror account settings

Post by mattg » 2018-11-21 02:12

And are the IMAP folders, folders within that account or Public IMAP folders?

Please enable all logging, run your tests again, wait 30 seconds then post all logs created


In summary,
To should be included in recipient list (as should CC and BCC where the recipient you are trying to find is the BCC - it will not find other BCC addresses)

Test with one criteria at a time, until you know that it works as expected, and that you don't have some logic error in your multiple criteria.

Mirror account really should be an account external to your hmailserver (or on a second hMailserver) to stop looping (i think)


These are a couple of my global rules, but account rules work the same
This is from my system (using the diagnostics report )
RULES
1, SPAM Criteria: Use AND
Subject Contains [hMailServer says this is SPAM]
Recipient List Not Contains spam@Domain9.com
-----Actions-----
Run Function CleanSubject
Forward spam@Domain9.com
Delete
---------------------------------------------------------------------
2, Spam Senders Criteria: Use OR
From Contains productivedeals.eu
From Contains productivedeal.eu
From Contains claimvoucher.click
From Contains cosponsordeals.com
Subject Contains You have received a giftcard
From Contains cosponsordeal
From Contains cosponsor
From Contains impactshopfitters
-----Actions-----
Delete
---------------------------------------------------------------------
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

gruenie
Senior user
Senior user
Posts: 299
Joined: 2004-01-23 03:25
Location: Germany, Halle

Re: Mirror account settings

Post by gruenie » 2018-11-23 15:11

Hello Matt,
thanx again for your help and sorry for the late reply.

To explain the details:
Later I want to delete all incoming and outgoing Mails of the domain "example.com" from the mirror-account.
For now I just move them in special folders (incoming, intern, outgoing, spam).
The reason is, that we installed a Firebox with APT-Blocker (sandbox) in front of the hmailserver and we do not want to lose mails in the testing time.
Maybe now its better understandable.

Later maybe I create a rule: if from or to or recipient list contains "@example.com" -> delete (or something like this).

The mirror-account is on the same hmailserver, but in a different domain.
The IMAP-folders are inside this mirror-account.

It seems, that "recipient list" do not include the "to-field".
When I add 'if to contains "example.com"' then the mails are moved.
Nevertheless some mails stay in the normal inbox, mostly when the recipient is only in the cc-field. Strange.
Errare humanum est, sed in errare perseverare diabolicum!

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

Re: Mirror account settings

Post by mattg » 2018-11-23 23:37

gruenie wrote:
2018-11-23 15:11
It seems, that "recipient list" do not include the "to-field".
When I add 'if to contains "example.com"' then the mails are moved.
Nevertheless some mails stay in the normal inbox, mostly when the recipient is only in the cc-field. Strange.
I don't have that issue

Is this because of the firebox sitting in front of your hmailserver perhaps?

The rule should use the SMTP envelop recipient list, but perhaps that doesn't exist and it uses the To and CC headers instead in your instance. You should also check CC headers with your rule.

How are BCC recipients handled? My guess is that mail addressed to a BCC recipient will simply be skipped
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

gruenie
Senior user
Senior user
Posts: 299
Joined: 2004-01-23 03:25
Location: Germany, Halle

Re: Mirror account settings

Post by gruenie » 2018-11-24 14:33

I have the following rule-set for incoming messages at the moment:

1.
if TO contains @example.com AND
if FROM not contains @example.com AND
if SUBJECT not contains [SPAM
-> move to imap folder xxx.inbox (inside the mirror-account)

2.
if RECIPIENT LIST contains @example.com AND
if FROM not contains @example.com AND
if SUBJECT not contains [SPAM
-> move to imap folder xxx.inbox (inside the mirror-account)

For inside mails (sender and recipients are from the same domain) I have an own rule.
Same for [SPAM].

This ruleset works - except to some mails which remains in the normal inbox.

To answer your question about BCC:
Some minutes before I have sent 2 emails from outside:
a) to an external account and only BCC to xxx@example.com
b) to an external account and only CC to xxx@example.com.
Both mails reach the BCC/CC, but remain in the normal inbox of the mirror-account and were not moved.
So it seems that the "recipient list" has absolutely no effect.
Errare humanum est, sed in errare perseverare diabolicum!

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

Re: Mirror account settings

Post by mattg » 2018-11-24 22:04

gruenie wrote:
2018-11-24 14:33
So it seems that the "recipient list" has absolutely no effect.
mattg wrote:
2018-11-23 23:37
Is this because of the firebox sitting in front of your hmailserver perhaps?

The rule should use the SMTP envelop recipient list, but perhaps that doesn't exist and it uses the To and CC headers instead in your instance. You should also check CC headers with your rule.
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

gruenie
Senior user
Senior user
Posts: 299
Joined: 2004-01-23 03:25
Location: Germany, Halle

Re: Mirror account settings

Post by gruenie » 2018-11-26 14:07

Matt,
Is this because of the firebox sitting in front of your hmailserver perhaps?
The rule should use the SMTP envelop recipient list, but perhaps that doesn't exist and it uses the To and CC headers instead in your instance. You should also check CC headers with your rule.
Of course I have read what you wrote before.
Maybe the Watchguard changes things in the header, I have no idea.

What you adviced me now to chack the TO and CC headers is what I did before in my rule.
My problem has been, that I had no idea how to filter messages which only have BCC headers (and no TO or CC).
Thats why you told me to use the recipient list...

But if the Watchguard modifies the header, how it is possible that messages, which only have BCC-header reach the recipients?
I'm lost. ;-)
Errare humanum est, sed in errare perseverare diabolicum!

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

Re: Mirror account settings

Post by mattg » 2018-11-26 23:55

It's not about modifying the headers

I'm suggesting it is because there is no SMTP envelope after the mail goes through your watchguard

My only suggestion would be to see if watchguard can add recipient headers (similar to the hmailserver delivered_to header), and then perhaps you can look for that header as part of your rules

I wonder, there must be some way that hMailserver works out who the email is for once it has been through watchguard, presumably without a SMTP envelope. How does hmailserver know who to deliver the message to?

What I'm also saying is that on my system (without watchguard) the 'recipient list' works fine for finding receipients
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

gruenie
Senior user
Senior user
Posts: 299
Joined: 2004-01-23 03:25
Location: Germany, Halle

Re: Mirror account settings

Post by gruenie » 2018-11-27 00:16

by mattg » 26.11.2018 22:55
It's not about modifying the headers
I'm suggesting it is because there is no SMTP envelope after the mail goes through your watchguard
This is what I meant with "modifying"! ;-)
by mattg » 26.11.2018 22:55
My only suggestion would be to see if watchguard can add recipient headers (similar to the hmailserver delivered_to header), and then perhaps you can look for that header as part of your rules
I wonder, there must be some way that hMailserver works out who the email is for once it has been through watchguard, presumably without a SMTP envelope. How does hmailserver know who to deliver the message to?
your last sentence also was what I thought!
If there is an email with "TO" to a recipient outside this domain and with "BCC" to a recipient inside this domain and this mail has been delivered, then the question is, where hmailserver knows where to deliver.
But you are right, there is an "Delivered-To: "-header in both cases (sent to CC and BCC).
And there is a "X-WatchGuard-Mail-Recipients:"-header, which contains the local recipient (in my test-cases the CC or the BCC).
Errare humanum est, sed in errare perseverare diabolicum!

Post Reply