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
bfedfb57
Commit
bfedfb57
authored
Oct 11, 2019
by
Claudemir Todo Bom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* one imapsieve script to rule them all
parent
51ddb3d1
Pipeline
#204
passed with stage
in 1 minute and 27 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
88 deletions
+35
-88
antispamsieve/learn.sieve
antispamsieve/learn.sieve
+32
-8
antispamsieve/learn_ham.sieve
antispamsieve/learn_ham.sieve
+0
-25
antispamsieve/learn_spam.sieve
antispamsieve/learn_spam.sieve
+0
-20
dovecot/conf.d/99-wwmail.conf
dovecot/conf.d/99-wwmail.conf
+3
-35
No files found.
antispamsieve/learn.sieve
View file @
bfedfb57
require
[
"vnd.dovecot.pipe"
,
"copy"
,
"
imapsieve"
,
"environment"
,
"variables"
,
"regex"
];
require
[
"vnd.dovecot.pipe"
,
"copy"
,
"
vnd.dovecot.imapsieve"
,
"environment"
,
"vnd.dovecot.environment"
,
"variables"
,
"regex"
];
if
environment
:matches
"
imap.mailbox
"
"*"
{
if
environment
:matches
"
vnd.dovecot.mailbox-to
"
"*"
{
set
:lower
"mailbox"
"
${1}
"
;
}
...
...
@@ -14,19 +14,43 @@ if string :regex "${mailbox}" "^(sent( .*)?|drafts|rascunhos|itens enviados)$" {
stop
;
}
# detect spam folders
if
environment
:matches
"imap.cause"
"*"
{
set
"cause"
"
${1}
"
;
}
if
string
:is
"
${cause}
"
"APPEND"
{
# Do not learn from Unknown (APPEND/Outlook) to Archive folders (risk of too much messages)
if
string
:regex
"
${mailbox}
"
"^(archive|arquivo).*"
{
stop
;
}
set
"fromtype"
"unknown"
;
}
elsif
environment
:matches
"vnd.dovecot.mailbox-from"
"*"
{
set
:lower
"frombox"
"
${1}
"
;
# Set type of origin folder
if
string
:regex
"
${frombox}
"
"^(junk( .*)?|spam|lixo eletr.*)$"
{
set
"fromtype"
"spam"
;
}
else
{
set
"fromtype"
"ham"
;
}
}
else
{
# COPY without could not determine origin folder / should never execute
stop
;
}
# Set type of destination folder
if
string
:regex
"
${mailbox}
"
"^(junk( .*)?|spam|lixo eletr.*)$"
{
set
"command"
"spam"
;
}
else
{
set
"command"
"ham"
;
}
if
environment
:matches
"imap.user"
"*"
{
set
"username"
"
${1}
"
;
# Do not learn when moving between same type folders
if
string
:is
"
${fromtype}
"
"
${command}
"
{
stop
;
}
if
environment
:matches
"imap.
cause
"
"*"
{
set
"
caus
e"
"
${1}
"
;
if
environment
:matches
"imap.
user
"
"*"
{
set
"
usernam
e"
"
${1}
"
;
}
pipe
:copy
"sa-learn-pipe.sh"
[
"
${username}
"
,
"
${command}
"
,
"
${cause}
"
,
"
${
mailbox}
"
];
pipe
:copy
"sa-learn-pipe.sh"
[
"
${username}
"
,
"
${command}
"
,
"
${cause}
"
,
"
${
frombox}
(
${fromtype}
)=>
${mailbox}
(
${command}
)
"
];
antispamsieve/learn_ham.sieve
deleted
100755 → 0
View file @
51ddb3d1
require
[
"vnd.dovecot.pipe"
,
"copy"
,
"imapsieve"
,
"environment"
,
"variables"
,
"regex"
];
if
environment
:matches
"imap.mailbox"
"*"
{
set
:lower
"mailbox"
"
${1}
"
;
}
# 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
;
}
if
environment
:matches
"imap.user"
"*"
{
set
"username"
"
${1}
"
;
}
if
environment
:matches
"imap.cause"
"*"
{
set
"cause"
"
${1}
"
;
}
pipe
:copy
"sa-learn-pipe.sh"
[
"
${username}
"
,
"ham"
,
"
${cause}
"
,
"
${mailbox}
"
];
antispamsieve/learn_spam.sieve
deleted
100755 → 0
View file @
51ddb3d1
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}
"
;
}
if
environment
:matches
"imap.cause"
"*"
{
set
"cause"
"
${1}
"
;
}
pipe
:copy
"sa-learn-pipe.sh"
[
"
${username}
"
,
"spam"
,
"
${cause}
"
,
"
${mailbox}
"
];
dovecot/conf.d/99-wwmail.conf
View file @
bfedfb57
...
...
@@ -6,6 +6,7 @@ mail_location = maildir:%h
mail_privileged_group
=
mail
mail_plugins
=
quota
mail_attribute_dict
=
file
:%
h
/
dovecot
-
attributes
imap_metadata
=
yes
imap_capability
= +
SPECIAL
-
USE
...
...
@@ -22,44 +23,11 @@ plugin {
sieve_plugins
=
sieve_imapsieve
sieve_extprograms
#
Append action - used by Outlook when moving!
#
Learn Spam/Ham
imapsieve_mailbox1_name
= *
imapsieve_mailbox1_causes
=
APPEND
imapsieve_mailbox1_causes
=
COPY
APPEND
imapsieve_mailbox1_before
=
file
:/
etc
/
wwmail
/
antispamsieve
/
learn
.
sieve
# From elsewhere to Junk folder
imapsieve_mailbox2_name
=
Junk
*
imapsieve_mailbox2_causes
=
COPY
imapsieve_mailbox2_before
=
file
:/
etc
/
wwmail
/
antispamsieve
/
learn_spam
.
sieve
# From Junk folder to elsewhere
imapsieve_mailbox3_name
= *
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
/
sieve_global_extensions
= +
vnd
.
dovecot
.
pipe
+
vnd
.
dovecot
.
environment
...
...
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