Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
wwmail
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Claudemir Todo Bom
wwmail
Commits
51ddb3d1
Commit
51ddb3d1
authored
Oct 10, 2019
by
Claudemir Todo Bom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* better spam learning
parent
cc8ae824
Pipeline
#203
passed with stage
in 1 minute and 24 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
64 additions
and
28 deletions
+64
-28
antispamsieve/learn.sieve
antispamsieve/learn.sieve
+9
-6
antispamsieve/learn_ham.sieve
antispamsieve/learn_ham.sieve
+10
-4
antispamsieve/learn_spam.sieve
antispamsieve/learn_spam.sieve
+11
-2
antispamsieve/sa-learn-pipe.sh
antispamsieve/sa-learn-pipe.sh
+1
-5
dovecot/conf.d/99-wwmail.conf
dovecot/conf.d/99-wwmail.conf
+33
-11
No files found.
antispamsieve/learn.sieve
View file @
51ddb3d1
require
[
"vnd.dovecot.pipe"
,
"copy"
,
"imapsieve"
,
"environment"
,
"variables"
];
require
[
"vnd.dovecot.pipe"
,
"copy"
,
"imapsieve"
,
"environment"
,
"variables"
,
"regex"
];
if
environment
:matches
"imap.mailbox"
"*"
{
set
"mailbox"
"
${1}
"
;
set
:lower
"mailbox"
"
${1}
"
;
}
if
string
:is
"
${mailbox}
"
[
"Trash"
,
"trash"
,
"Deleted Items"
,
"deleted messages"
]
{
# do not process Trash folders
if
string
:regex
"
${mailbox}
"
"^(trash|deleted( .*)?|itens exclu.*)$"
{
stop
;
}
if
string
:is
"
${mailbox}
"
[
"Sent"
,
"Archive"
,
"Drafts"
]
{
# do not process Draft and Sent folders
if
string
:regex
"
${mailbox}
"
"^(sent( .*)?|drafts|rascunhos|itens enviados)$"
{
stop
;
}
if
string
:is
"
${mailbox}
"
[
"Junk"
,
"junk"
,
"spam"
,
"Spam"
,
"SPAM"
,
"Junk E-mail"
]
{
# detect spam folders
if
string
:regex
"
${mailbox}
"
"^(junk( .*)?|spam|lixo eletr.*)$"
{
set
"command"
"spam"
;
}
else
{
set
"command"
"ham"
;
...
...
@@ -26,4 +29,4 @@ if environment :matches "imap.cause" "*" {
set
"cause"
"
${1}
"
;
}
pipe
:copy
"sa-learn-pipe.sh"
[
"
${username}
"
,
"
${command}
"
,
"
${cause}
"
];
pipe
:copy
"sa-learn-pipe.sh"
[
"
${username}
"
,
"
${command}
"
,
"
${cause}
"
,
"
${mailbox}
"
];
antispamsieve/learn_ham.sieve
View file @
51ddb3d1
require
[
"vnd.dovecot.pipe"
,
"copy"
,
"imapsieve"
,
"environment"
,
"variables"
];
require
[
"vnd.dovecot.pipe"
,
"copy"
,
"imapsieve"
,
"environment"
,
"variables"
,
"regex"
];
if
environment
:matches
"imap.mailbox"
"*"
{
set
"mailbox"
"
${1}
"
;
set
:lower
"mailbox"
"
${1}
"
;
}
if
string
"
${mailbox}
"
"Trash"
{
# do not process Trash folders
if
string
:regex
"
${mailbox}
"
"^(trash|deleted( .*)?|itens exclu.*)$"
{
stop
;
}
# do not process Junk folders
if
string
:regex
"
${mailbox}
"
"^(junk( .*)?|spam|lixo eletr.*)$"
{
stop
;
}
...
...
@@ -16,4 +22,4 @@ if environment :matches "imap.cause" "*" {
set
"cause"
"
${1}
"
;
}
pipe
:copy
"sa-learn-pipe.sh"
[
"
${username}
"
,
"ham"
,
"
${cause}
"
];
pipe
:copy
"sa-learn-pipe.sh"
[
"
${username}
"
,
"ham"
,
"
${cause}
"
,
"
${mailbox}
"
];
antispamsieve/learn_spam.sieve
View file @
51ddb3d1
require
[
"vnd.dovecot.pipe"
,
"copy"
,
"imapsieve"
,
"environment"
,
"variables"
];
require
[
"vnd.dovecot.pipe"
,
"copy"
,
"imapsieve"
,
"environment"
,
"variables"
,
"regex"
];
if
environment
:matches
"imap.mailbox"
"*"
{
set
:lower
"mailbox"
"
${1}
"
;
}
# Work only on Junk folders - exit if not
if
not
string
:regex
"
${mailbox}
"
"^(junk( .*)?|spam|lixo eletr.*)$"
{
stop
;
}
if
environment
:matches
"imap.user"
"*"
{
set
"username"
"
${1}
"
;
...
...
@@ -8,4 +17,4 @@ if environment :matches "imap.cause" "*" {
set
"cause"
"
${1}
"
;
}
pipe
:copy
"sa-learn-pipe.sh"
[
"
${username}
"
,
"spam"
,
"
${cause}
"
];
pipe
:copy
"sa-learn-pipe.sh"
[
"
${username}
"
,
"spam"
,
"
${cause}
"
,
"
${mailbox}
"
];
antispamsieve/sa-learn-pipe.sh
View file @
51ddb3d1
...
...
@@ -7,9 +7,6 @@ MYPID=$$
TEMPFILE
=
/var/spool/maildir/salearn-queue/salearn-msg-
$$
.
$RANDOM
.msg
cat
-
>
${
TEMPFILE
}
## DEBUG
## echo /usr/bin/sa-learn $* /tmp/sendmail-msg-$$.txt
### check if queue is being read
(
[
-f
/var/run/sa-learn-queue/sa-learn-queue.pid
]
\
&&
SAQ_PID
=
$(
cat
/var/run/sa-learn-queue/sa-learn-queue.pid
)
\
...
...
@@ -18,10 +15,9 @@ cat - > ${TEMPFILE}
SAUSER
=
"
$1
"
SACOMMAND
=
"--
$2
"
SACAUSE
=
"
$3
"
[
-e
/var/spool/maildir/salearn.pipe
]
||
(
/usr/bin/mkfifo /var/spool/maildir/salearn.pipe
&&
/bin/chmod ugo+r /var/spool/maildir/salearn.pipe
)
[
"
${
SACOMMAND
}
"
]
&&
[
"
${
SAUSER
}
"
]
&&
[
"
${
TEMPFILE
}
"
]
&&
echo
"
${
SACOMMAND
}
${
SAUSER
}
${
TEMPFILE
}
"
>
/var/spool/maildir/salearn.pipe
/usr/bin/logger
-p
mail.notice
-t
sa-learn-pipe
\[
${
MYPID
}
\]
"added to queue:
Cause
${
SACAUSE
}
/ command:
${
SACOMMAND
}
${
SAUSER
}
${
TEMPFILE
}
"
/usr/bin/logger
-p
mail.notice
-t
sa-learn-pipe
\[
${
MYPID
}
\]
"added to queue:
${
TEMPFILE
}
$*
"
dovecot/conf.d/99-wwmail.conf
View file @
51ddb3d1
...
...
@@ -22,21 +22,43 @@ plugin {
sieve_plugins
=
sieve_imapsieve
sieve_extprograms
#
From elsewhere to Junk folder
imapsieve_mailbox1_name
=
Junk
imapsieve_mailbox1_causes
=
COPY
imapsieve_mailbox1_before
=
file
:/
etc
/
wwmail
/
antispamsieve
/
learn
_spam
.
sieve
#
Append action - used by Outlook when moving!
imapsieve_mailbox1_name
=
*
imapsieve_mailbox1_causes
=
APPEND
imapsieve_mailbox1_before
=
file
:/
etc
/
wwmail
/
antispamsieve
/
learn
.
sieve
# From Junk folder to elsewhere
imapsieve_mailbox2_name
= *
imapsieve_mailbox2_from
=
Junk
# From elsewhere to Junk folder
imapsieve_mailbox2_name
=
Junk
*
imapsieve_mailbox2_causes
=
COPY
imapsieve_mailbox2_before
=
file
:/
etc
/
wwmail
/
antispamsieve
/
learn_
h
am
.
sieve
imapsieve_mailbox2_before
=
file
:/
etc
/
wwmail
/
antispamsieve
/
learn_
sp
am
.
sieve
#
Append action - used by Outlook when moving!
#
From Junk folder to elsewhere
imapsieve_mailbox3_name
= *
imapsieve_mailbox3_causes
=
APPEND
imapsieve_mailbox3_before
=
file
:/
etc
/
wwmail
/
antispamsieve
/
learn
.
sieve
imapsieve_mailbox3_from
=
Junk
*
imapsieve_mailbox3_causes
=
COPY
imapsieve_mailbox3_before
=
file
:/
etc
/
wwmail
/
antispamsieve
/
learn_ham
.
sieve
# Variations of Junk folder names
imapsieve_mailbox4_name
=
Spam
*
imapsieve_mailbox4_causes
=
COPY
imapsieve_mailbox4_before
=
file
:/
etc
/
wwmail
/
antispamsieve
/
learn_spam
.
sieve
# From Junk folder to elsewhere
imapsieve_mailbox5_name
= *
imapsieve_mailbox5_from
=
Spam
*
imapsieve_mailbox5_causes
=
COPY
imapsieve_mailbox5_before
=
file
:/
etc
/
wwmail
/
antispamsieve
/
learn_ham
.
sieve
imapsieve_mailbox6_name
=
Lixo
*
imapsieve_mailbox6_causes
=
COPY
imapsieve_mailbox6_before
=
file
:/
etc
/
wwmail
/
antispamsieve
/
learn_spam
.
sieve
# From Junk folder to elsewhere
imapsieve_mailbox7_name
= *
imapsieve_mailbox7_from
=
Lixo
*
imapsieve_mailbox7_causes
=
COPY
imapsieve_mailbox7_before
=
file
:/
etc
/
wwmail
/
antispamsieve
/
learn_ham
.
sieve
sieve_pipe_bin_dir
= /
etc
/
wwmail
/
antispamsieve
/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment