Page 1 of 1

Global rule to catch all incoming mail

Posted: 2015-03-20 10:58
by Hazark
I need a copy of e-mails which originated from an external server. Anyone have an idea on that?

If this is not possible (within hmailserver), I need to catch all incoming mail to server and forward (or save a copy) to another address. I can manually filter it against my users addresses later.
Global rules and mirror function triggers from inbound AND outbound traffic so it's not usable for my scenerio.

If I hit the language barrier on my post above; here is a visualization

Code: Select all

Sender          | Receiver          | Do I need a copy of that
==============================================================
*@external.com  | *@dtroms.com      | YES
*@dtroms.com    | *@dtroms.com      | NO
*@dtroms.com    | *@external.com    | NO

dtroms = domain that resides on my server
Thanks.

Re: Global rule to catch all incoming mail

Posted: 2015-03-20 11:28
by jimimaseye
Hazark wrote:Global rules and mirror function triggers from inbound AND outbound traffic so it's not usable for my scenerio.
Not true.

GLOBAL RULE

if
FROM ....not contain.... DTROMS.COM
then
forward....

Make sure you code the rule for LOOPS

Re: Global rule to catch all incoming mail

Posted: 2015-03-20 11:45
by Hazark
The problem is dtroms.com actually a placeholder that means "domain that resides on my server" and there are many of them.
If I choose that way, I must list every domain I have on the rule definition and update it when a new domain added/removed on the server.

Doable, maybe I can automate the rule definition update process with mysql triggers. If anyone thinks another way to do this, please post it; thanks.

Re: Global rule to catch all incoming mail

Posted: 2015-03-20 14:19
by SorenR
Hazark wrote:I need a copy of e-mails which originated from an external server. Anyone have an idea on that?

If this is not possible (within hmailserver), I need to catch all incoming mail to server and forward (or save a copy) to another address. I can manually filter it against my users addresses later.
Global rules and mirror function triggers from inbound AND outbound traffic so it's not usable for my scenerio.

If I hit the language barrier on my post above; here is a visualization

Code: Select all

Sender          | Receiver          | Do I need a copy of that
==============================================================
*@external.com  | *@dtroms.com      | YES
*@dtroms.com    | *@dtroms.com      | NO
*@dtroms.com    | *@external.com    | NO

dtroms = domain that resides on my server
Thanks.
How is your VBScript ?

Following assume authentication is active for local accounts..

Code: Select all

EventHandlers.vbs


   Sub OnAcceptMessage(oClient, oMessage)
      If (oClient.Username = "") Then
         oMessage.HeaderValue("X-dtroms-True") = "YES"
         oMessage.Save
      End If
   End Sub


Global Rule

   Criteria (AND):
      If Custom header field "X-hMailServer-LoopCount" < 1
      If Custom header field "X-dtroms-True" = "YES"

   Action:
      Forward email "dtroms@acme.inc"

Re: Global rule to catch all incoming mail

Posted: 2015-03-20 14:50
by Hazark
SorenR wrote: Following assume authentication is active for local accounts..

..code..
Authentication is enabled and your solution seems working well (based on my 2 minute test). Will try for longer periods.

Thanks and have a nice day.