Here are some ideas :
1/ Create a directory somewhere in /var/, for example mailstats2/ The directory 
will contain one file per sender3/ Your bash script will parse the mail log 
file in real time (tail -f) then tee each matching line to the corresponding 
mailstats/user file, for example if the line is matching b...@yourdomain.com it 
will go to mailstats/bob. That way you will have, for each user, the number of 
outgoing emails.


Another script will simply wc -l each mailstats user file, that will give you 
the number of sent mails. You can use fail2ban for this task instead of writing 
you own script. Fail2ban can be configured to scan logfiles looking for a 
particular line. It will count the matching lines and if it reaches the 
(configurable) maximum count in a certain (configurable) amount of time, it 
will do whatever action you have configured, for example sending you an e-mail.
The mailstats file will need some maintenance, otherwise they will grow 
infinitely and possibly slow down you scripts. You can use logrotate to archive 
your mailstats files and create new ones automatically for you after either a 
specific amount of time or after a specific mail size. 

It's not trivial, but it should work.

Yassine.


    On Friday, March 30, 2018, 7:16:33 AM GMT+2, Poliman - Serwis 
<ser...@poliman.pl> wrote:  
 
 Some emails has "Hits" value even, for example 2,5. What is (if it's possible 
to say) good value? I am going to create script in bash  which send me an email 
when from particular email account will outbound for example 300 emails per 
day. Kind of warning. But I am not sure I could use spam score to it. What do 
you think guys about it?

2018-03-29 17:58 GMT+02:00 chaouche yacine <yacinechaou...@yahoo.com>:

 
It is, that's the spam score. It helps to visualise if a particular mailbox is 
bombarded with spam (can happen with lots and lots of e-mails from qq.com, I 
have that domain banned in postfix itself).
Yassine.
    On Thursday, March 29, 2018, 3:21:16 PM GMT+1, Alex JOST 
<jost+postfix...@dimejo.at> wrote:  
 
 Am 29.03.2018 um 15:30 schrieb Poliman - Serwis:
> This one works well. One question based on one from generated lines:
> Mar 26 11:47:41  ORIGINATING LOCAL [127.0.0.1]:38920 <i...@klub-biosfera.pl>
> -> <i...@klub-biosfera.pl>,<p. krzewi...@poliman.pl>, Hits: 0.742
> 
> Mar 26 11:47:41 --> this is date and hour when mail from
> i...@klub-biosfera.pl was sent to i...@klub-biosfera.pl and
> p.krzewi...@poliman.pl, am I right?
> What are "Hits: 0.742" ?

Looks like amavisd scoring.

-- 
Alex JOST
  



-- 
Pozdrawiam / Best Regards
Piotr Bracha
  

Reply via email to