Page 1 of 1

Duplicate number of emails due to complex forwarding rules

Posted: 2019-09-18 08:23
by askrahulsingh
Hello guys!!

I am not expert in hMailserver so my question might look silly for you :)

I have a case where user2 emails forwarding set to user3, suppose user1 is sending an email to user2 and mark user3 in CC then user3 getting 2 number of copies.

Example:
1) User2-->Forwarding set to-->User3

2)User1-->Email-->To: User2, CC: User3

3) User3 receiving 2 copies of same email

Can you please help me setting a RULE in hMailServer so that only one copy of emails would be deliver (Unique email Delivery based on message ID)

Re: Duplicate number of emails due to complex forwarding rules

Posted: 2019-09-18 09:16
by mattg
But there ARE two emails
#1 to user2, and #2 to user3

Re: Duplicate number of emails due to complex forwarding rules

Posted: 2019-09-18 11:36
by katip
askrahulsingh wrote:
2019-09-18 08:23
Can you please help me setting a RULE in hMailServer so that only one copy of emails would be deliver (Unique email Delivery based on message ID)
no. not with rules.
this was one of my favorite(!) problems ever.
you need to capture Message-IDs in a seperate DB table and do lookups prior to delivery.

Re: Duplicate number of emails due to complex forwarding rules

Posted: 2019-09-19 08:20
by askrahulsingh
May I please ask you to help me setting up these changes? I have a file called "EventHandlers.vbs", do I need to add some more scripts into it.

How do I process the messages for uniqueness?

Re: Duplicate number of emails due to complex forwarding rules

Posted: 2019-09-19 09:14
by askrahulsingh
katip wrote:
2019-09-18 11:36
askrahulsingh wrote:
2019-09-18 08:23
Can you please help me setting a RULE in hMailServer so that only one copy of emails would be deliver (Unique email Delivery based on message ID)
no. not with rules.
this was one of my favorite(!) problems ever.
you need to capture Message-IDs in a seperate DB table and do lookups prior to delivery.
May I please ask you to help me setting up these changes? I have a file called "EventHandlers.vbs", do I need to add some more scripts into it.

How do I process the messages for uniqueness?

Re: Duplicate number of emails due to complex forwarding rules

Posted: 2019-09-19 12:05
by katip
1. you set up a table in a seperate DB (not HMS DB), simply with MessageID and account address columns.
2. in account rules you need to call a function by rule #1 for each arriving message (if MessageSize > 0 then call a function) which looks up MsgID + address pair, if found, it writes a header (such as X-HMS-Duplicate = YES). if not found it merely creates a new record with this pair.
3. next rule #2 checks this header, if it finds it moves the message to a trash public folder as it means this account already got a copy of this mail. otherwise delivery is finished.

i think you understand the logic. sorry but i can't offer my own script as it's very customized and not documented.
and yes, all should be written in EventHandlers.vbs file.

Re: Duplicate number of emails due to complex forwarding rules

Posted: 2019-09-23 09:01
by askrahulsingh
katip wrote:
2019-09-19 12:05
1. you set up a table in a seperate DB (not HMS DB), simply with MessageID and account address columns.
2. in account rules you need to call a function by rule #1 for each arriving message (if MessageSize > 0 then call a function) which looks up MsgID + address pair, if found, it writes a header (such as X-HMS-Duplicate = YES). if not found it merely creates a new record with this pair.
3. next rule #2 checks this header, if it finds it moves the message to a trash public folder as it means this account already got a copy of this mail. otherwise delivery is finished.

i think you understand the logic. sorry but i can't offer my own script as it's very customized and not documented.
and yes, all should be written in EventHandlers.vbs file.
Thank you so much for your response, Yaah I understood the logic of handling the duplicate messages.

Let me work on it, will take time for me but I will do it hopefully :)