Hi!

Yesterday I suggested that it yould be useful to additionally consider
the message-ids of the "In-Reply-To" or "References" headers for the
penpals feature.

I've now done a small patch that implements that behavior. (Attached.)
It uses the Message-Ids of the "References" header of an incoming mail
to search for matching outgoing mails that this mail is a reply to.

Of course parsing of the Reply-header could be improved but it's just a
quick proof of concept.

The Message-Ids of previously outgoing messages are only considered if
they were:
- not a spam, virus, etc. (clean) (content='C') and
- if there is at least one recipient with deliver status 'P' (passed)
  and who isn't the sender

-------------------- snip! --------------------
    'sel_penpals_msgid' =>
      "SELECT msgs.time_num, msgs.mail_id, subject".
      " FROM msgs".
      " WHERE sid=? AND msgs.message_id=? AND content='C'".
      "  AND EXISTS (".
      "   SELECT 1 FROM msgrcpt".
      "    WHERE msgrcpt.mail_id = msgs.mail_id".
      "     AND msgrcpt.rid <> msgs.sid AND ds='P' )".
      " ORDER BY msgs.time_num DESC LIMIT 1",
-------------------- snip! --------------------

When doing penpal checks, both lookups (first based on sender and
recipient-adresses and second based on the recipient of the incoming
mail and on the message-id) are done and the result with the highest
timestamp is used if both are successful.

I believe that this could be an important feature because the current
penpal-feature misses one case that is quite common in practice:
You send out an email and the recipient replys with a different address.
(E.g. you send the email to "[EMAIL PROTECTED]" and the reply comes
from "[EMAIL PROTECTED]" or from "[EMAIL PROTECTED]" or ...)

I hope you'll find it useful and maybe consider it for future inclusion.

Cheers,
--leo

P.S.: Maybe there should be an index on msgs.message_id if this feature
is enabled.

-- 
-----------------------------------------------------------------------
[EMAIL PROTECTED]                Fax: +43-1-31336-906050
Zentrum fuer Informatikdienste - Wirtschaftsuniversitaet Wien - Austria

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
AMaViS-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/amavis-user
AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3
AMaViS-HowTos:http://www.amavis.org/howto/

Reply via email to