Difference between revisions of "Mailsorting"
Unnilennium (talk | contribs) |
(→individual setting: rewrite to provide a better description of the issue) |
||
Line 95: | Line 95: | ||
− | === | + | ===Custom Rules=== |
− | + | By design the mail user .procmailrc file is built from SME templates whenever a system update is performed. You can disable that action by enabling "geekmode", using the command below. With that done, you may write your own .procmailrc file and place it in the appropriate mail directory. | |
db accounts setprop USERNAME geekmode enabled | db accounts setprop USERNAME geekmode enabled | ||
+ | |||
+ | Geekmode implies you know what you are doing when creating a custom .procmailrc file. | ||
===Testing=== | ===Testing=== |
Revision as of 20:35, 21 October 2017
Sorting mail with Maildrop or Procmail
Version
Installation
- For sme8 and sme9
yum install smeserver-mailsorting --enablerepo=smecontribs
Allows a user to configure mail rules with the UserManager
Procmail or maildrop is used to process your email on the server. It follows user defined rules. Common uses are to sort mail into folders or forward selected email on to other email addresses. The rules that you define are executed as email arrives in your mailbox on the server, and are independent of your email client. If you sort to folders you will need to use a IMAP mail client to read them.
Rule List
The panel shows a table of active rules and the order they are executed in. Each rule has links to modify or remove them.
A yes* in 'copy to' copies the email to your inbox
Create Rules
A user defines a pattern for emails that if matched, an action occurs.
The rule fields are in fact regular expressions compatible with egrep. As a result the above cited characters are interpreted as structure of the language. Refer to "man egrep" for correct syntax. As an example if you want to catch mails with the subject including "[mymailinglist]", your rule will be :
\[mymailinglist\]
Also please note that that character "|" (pipe) is the default character used to separate fields in the internal database, so it is forbidden.
Configuration
Enable mailsorting
Use either procmail or maildrop
db configuration setprop qmail FilterType procmail db configuration setprop qmail FilterType maildrop db configuration delprop qmail FilterType [delete to disable]
If you want to bypass filtering for an individual user
db accounts setprop user MailFilter bypass db accounts delprop user MailFilter [delete to disable]
after any command
signal-event mailsorting-conf
Any mail that passes through procmail or maildrop without matching a rule
is delivered according to the existing user setting.
ie. deliver locally, forward or both.
Sieve compatibility
Only For SME9
Once Sieve enabled by the Contrib smeserver-dovecot-extras, filter rules defined in a user's ~/.procmailrc or ~/.mailfilter file are applied prior to the mail getting passed to dovecot-lda and Sieve. If you want to prohibit the use of Sieve for a determined User
db accounts setprop USERNAME Sieve disabled signal-event mailsorting-conf
Deleting duplicates
Procmail will automatically delete duplicate email.
Maildrop has to be enabled at the command line
Individually
db processmail setprop USERNAME deldups yes signal-event mailsorting-conf
To enable for all users
db processmail setprop maildrop deldups yes signal-event mailsorting-conf
Create a global rule
db commands
It's possible just to use db commands, here is a subset of options
db processmail setprop 50001 pmGlobalRule action delete basis subject criterion xyz
50001: is the rule precedence
action: is either - sort delete forward
basis: match against this - headers Subject To From
criterion: using the text entered here - 'xyz'
fragments
For more flexibility create a fragment in templates-user, expand template as above
Custom Rules
By design the mail user .procmailrc file is built from SME templates whenever a system update is performed. You can disable that action by enabling "geekmode", using the command below. With that done, you may write your own .procmailrc file and place it in the appropriate mail directory.
db accounts setprop USERNAME geekmode enabled
Geekmode implies you know what you are doing when creating a custom .procmailrc file.
Testing
Create a simple rule, eg Subject = xyz > forward to USER2
Send an email to USERNAME to match, check in USER2's inbox
View the logs
- For Maildrop
tail -50 /home/e-smith/files/users/USERNAME/mailfilter.log
- For Procmail
tail -50 /home/e-smith/files/users/USERNAME/procmail.log
View the rules
- For Maildrop
less /home/e-smith/files/users/USERNAME/.mailfilter
- For Procmail
less /home/e-smith/files/users/USERNAME/.procmailrc
Bugs
Please raise bugs under the SME-Contribs section in bugzilla and select the smeserver-mailsorting component or use this link .
ID | Product | Version | Status | Summary (4 tasks) ⇒ |
---|---|---|---|---|
11338 | SME Contribs | Futur | UNCONFIRMED | Copy rules from one user account to another |
10517 | SME Contribs | 9.2 | CONFIRMED | EmailForward and ForwardAddress properties are used in mailfilter rules but not in procmail |
8572 | SME Contribs | 8.1 | UNCONFIRMED | maildrop: delivery deferred |
4662 | SME Contribs | 7.3 | CONFIRMED | Special characters input in match criterion breaks mail sort rules |
Changelog
Only versions released in smecontrib are listed here.
- apply locale 2021-08-22 patch
- add requirement for maildrop and procmail [SME: 11578]
- add update event to avoid need of reboot [SME: 10952]
- First import to SME10 [SME: 10952]
- apply locale 2017-12-02 patch