how to know the mail type SENT vs REPLY vs FORWARD

Use this forum if you have problems with a hMailServer script, such as hMailServer WebAdmin or code in an event handler.
Post Reply
naren
New user
New user
Posts: 14
Joined: 2019-04-30 09:01

how to know the mail type SENT vs REPLY vs FORWARD

Post by naren » 2019-05-11 18:27

Is there a way to know the type of mail whether its a SENT or REPLY or FORWARD mail ?

I created a global rule on "From" criteria and calling a function on "action".

Now in that function, how to know/differentiate whether its a SENT or REPLY or FORWARD mail ?

(or) Is there any other approach to know the mail type on email SENT.

(or) is there any way to create different global rules to run 3 different actions/functions on SENT or REPLY or FORWARD mail ?

Thanks.

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

Re: how to know the mail type SENT vs REPLY vs FORWARD

Post by mattg » 2019-05-12 00:34

An email is an email

SOME mail clients track email threads, but mail servers rarely do (if at all)
Mail clients tend to prepend 'FWD:' to the subject of forwards, and 'RE:' to the subject of Replies, but there is no guarantee that this means that a message has been forwarded or replied, and in fact I see many spam mails that start with either a FWD or a RE in an attempt to get past some spam rules

In reality, you can't tell for sure
Just 'cause I link to a page and say little else doesn't mean I am not being nice.
https://www.hmailserver.com/documentation

User avatar
katip
Senior user
Senior user
Posts: 657
Joined: 2006-12-22 07:58
Location: Istanbul

Re: how to know the mail type SENT vs REPLY vs FORWARD

Post by katip » 2019-05-12 01:54

servers tend to add headers such as References, In-Reply-To, Thread-Index... if none of them is present, very likely it's an initially sent mail, otherwise either a forward, reply or maybe report. but as mattg suggests, for a server mail is mail, there is no 100% safe criteria for what you want to achieve. at most initial or not by checking those headers, but also that's not 100% safe IMO.
Katip
--
HMS 5.7.0-B2428-LTS-64-bit, MySQL 5.7.24, SA 3.4.2, ClamAV 0.101.2 + SaneS

Post Reply