Thank you for your time and long explanation. It was really helpful for me.
Bill Cole <postfixlists-070...@billmail.scconsult.com>, 12 Ağu 2020 Çar, 01:10 tarihinde şunu yazdı: > On 11 Aug 2020, at 10:48, jin&hitman&Barracuda wrote: > > > Hello, > > > > I'ld like to ask some questions about filtering/scanning mails. I'm > > using > > Postfix-3.4.14 in my setup. However, the questions aren't directly > > related > > with Postfix but, as a newbie I don't have such an opportunity to ask > > this > > kind of questions to anyone except this list, so please accept my > > apologies. > > I need a design which allows me to scan/check e-mails (the DATA > > portion) > > against some words stored in the SQL table. Actually, there are two > > tables stored in the same SQL DB which are named "white" and "black". > > As > > you probably guess, white db table contains the words acceptable and > > black > > contains the contrary. > > To what end? > > If the goal is to filter "spam" (specifically: unsolicited bulk email) > then I agree with Dr. Venema: try SpamAssassin, either with the > single-purpose spamass-milter or via some more comprehensive milter like > MIMEDefang or Amavis. However you hook up SpamAssassin to Postfix, it > will not make a simple binary decision on filtering based on trivial SQL > tables as described, because that mechanism is completely inadequate for > spam filtering. SA does include a Naive Bayesian statistical filter that > can run out of a SQL RDBMS, and I suppose one could train that filter > artificially to behave much like simple allow/deny lists of words, but I > would not recommend that approach. SA is not designed or intended to > operate as a generic filter, it is only really useful for spam > filtering. (Full disclosure: I don't speak for the SpamAssassin Project, > but I am a member of the PMC.) > > If the goal is the process, i.e. to use simple allow/deny lists of words > in a SQL DB to categorize messages, then SpamAssassin in any normal sort > of configuration is not the right tool. If you can write a relatively > small amount of Perl, then MIMEDefang might be. It is a general > filtering framework which CAN use SA and other filtering tools, but it > is customized by writing Perl subroutines and designed to do complex > message manipulation, so it could be used as a platform for the sort of > filtering that you propose. > > > When I try to find a method, I've found milter > > options. There are many milters out there and they offer different > > features. Looks like i have to write one to serve my requirements. > > But, I > > still don't know the answers of the questions listed below. > > > > - Are there any other options that allow me to scan a mail against > > values > > stored in an SQL database ? > > I am aware of no such tool for use with Postfix or any other MTA. For > the purposes that most people want to filter mail, that mechanism is > just too simplistic. > > > - If the only way is using a milter to achieve this goal, when exactly > > i > > should send it to the milter ? Does it matter ? > > I'm not clear on what you mean by that... > > A milter registers callback routines with the MTA based on what aspects > of the SMTP transaction it wants to filter. Since you are filtering the > message body, you'd need to register xxfi_body() and xxfi_eom() > callbacks if you build a custom milter. Postfix makes those calls > synchronously at the end of the SMTP DATA command, the only time when it > has message data. > > > - (Sorry for this one but, let me ask this specific question once.) > > Instead > > of writing a new milter, can I use "proxsmtp" project for that purpose > > ? > > I'm not familiar with it, but it appears to be a SMTP proxy, not a > milter. It may or may not work with Postfix's proxy interface. Whether > you can make it filter mail in the manner you desire, I do not kn ow. > > -- > Bill Cole > b...@scconsult.com or billc...@apache.org > (AKA @grumpybozo and many *@billmail.scconsult.com addresses) > Not For Hire (currently) > -- *There is no place like "/home"* *Tuco (Benedicto Pacifico Juan Maria) Ramirez*