is there a way programaticaly edit and save message after it arives to mailfile via agent that would run on event and at the same time modify subject line?
Subject: An agent within the database can be triggered after Mail arrives, yes
just look at the new Agent Propperties.
And to change the subject do the agent of type @Formula and do something like this:
FIELD Subject := Subject + " - this friendly text was added by the new agent";
“”