setup_basic_mailserver_with_postfix_dovecot_sieve

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revisionBoth sides next revision
setup_basic_mailserver_with_postfix_dovecot_sieve [02.01.2020 08:34] – [proxmox mail gateway] Pascal Sutersetup_basic_mailserver_with_postfix_dovecot_sieve [02.01.2020 09:01] – [future improvements] Pascal Suter
Line 469: Line 469:
  
 ==== future improvements ==== ==== future improvements ====
 +=== Bayesian learning by moving mail to junk folder ===
 in order for proxmox's Bayesian filter to learn and start working you need to provide spam and ham mails. to do this, one needs to copy spam that passed the filter to a temporary location on the proxmox mail gateway and then tell the Bayesian filter that this is spam. it needs at least 200 spam and ham mails to start working. ideally, we should be able to do this by simply moving an email to the spam folder on our imap account and the email should then be submitted to the bayesian filter of PMG automatically..  in order for proxmox's Bayesian filter to learn and start working you need to provide spam and ham mails. to do this, one needs to copy spam that passed the filter to a temporary location on the proxmox mail gateway and then tell the Bayesian filter that this is spam. it needs at least 200 spam and ham mails to start working. ideally, we should be able to do this by simply moving an email to the spam folder on our imap account and the email should then be submitted to the bayesian filter of PMG automatically.. 
  
Line 475: Line 476:
   * a solution on how to use imap sieve filters to trigger a bash script when a mail is moved into a specific folder can be found in the [[https://workaround.org/ispmail/buster/filtering-out-spam-with-rspamd-2/|all mighty ISPmail tutorial]]   * a solution on how to use imap sieve filters to trigger a bash script when a mail is moved into a specific folder can be found in the [[https://workaround.org/ispmail/buster/filtering-out-spam-with-rspamd-2/|all mighty ISPmail tutorial]]
  
-i'not sure yet, but i might want to only tag spam but still send it to the mailserver so that it can be stored to a spam folder and is instantly searchable by any user in his own account. not sure I or my users are happy with waiting for reports to find out why a recently sent mail did not reach them. +=== tag and deliver spam instead of quarantine === 
 +I'm not sure I or my users would be happy with waiting for reports to find out why a recently sent mail did not reach them. after all it's always a good feeling if you can tell someone on the phone that you didn't find their email in your spam folder either, to convince them that they might have had a typo in your email address :) ..  
 + 
 +i've started this already. First you need to make sure that spam is no longer quarantined but instead marked and forwarded.  
 + 
 +in the PMG web interface click on ''Mail Filter'' in the left column. you will now see a list of all active or inactive mail filters. by selecting a filter, you can then see on the right hand side column which actions will be executed. you can simply remove the Quarantine action from the active ones and then drag and drop the "Modify subject" up to activate it.  
 + 
 +now on to your postfix mail server.. we need to add a global sieve rule to dovecot that will move spam into a spam folder.. edit ''/etc/dovecot/conf.d/90-sieve.conf'' and look for "sieve_after" templates.. add a new line after those that looks like this:  
 +  sieve_after = /etc/dovecot/sieve-after 
 +now create the sieve-after directory:  
 +  mkdir /etc/dovecot/sieve-after 
 +all filters found in this directory will be executed AFTER each user's own filters. so a user can create his own filters to whitelist spam in our case.  
 +<code> 
 +cat > /etc/dovecot/sieve-after/spam-to-folder.sieve <<EOF 
 +require ["fileinto","mailbox"]; 
 + 
 +if header :contains "X-SPAM-LEVEL"
 + fileinto :create "INBOX.Junk"; 
 + stop; 
 +
 +EOF 
 +</code> 
 +** this filter won't compile.. i need to fix this!** 
 +now compile the sieve filter:  
 +  sievec /etc/dovecot/sieve-after/spam-to-folder.sieve
  
 ==== adjustments to postfix settings on our mailserver ==== ==== adjustments to postfix settings on our mailserver ====
  • setup_basic_mailserver_with_postfix_dovecot_sieve.txt
  • Last modified: 20.03.2021 07:47
  • by Pascal Suter