Server-side email rules Linux hosting
Under certain conditions you can use server-side rules on our Linux (DirectAdmin) servers. For this we use Exim filters.
- We do not provide support for creating server-side rules
- Filters only work on mail sent to the default account. So if your control panel username is boer122, that is boer122@servernaam.webawere.nl (servernaam is the server name, e.g. linux88). If you want to use the rules, you can, for example, have mail from a normal email address forwarded to the default account.
- Mistakes in the .forward file can stop your mail from working altogether. So be careful.
- Do not attempt this unless you are familiar with the subject.
- To activate server-side rules, create the file .forward in the root directory. Some FTP programs cannot read files that start with a dot; in that case you can create this file via Files in the control panel. To edit it, temporarily rename it to, for example, forward.txt and rename it back to .forward after editing.
The first line of this file must always contain: # exim filter
You can then add all kinds of commands to this file. Here we will limit ourselves to a few examples. If you have messages saved to a particular folder, make sure that folder already exists.
unseen deliver test@example.com
This forwards every message to the email address given. unseen makes sure the message keeps its unread status.
if $header_subject: contains "jajaja" or
$header_subject: contains "neeneenee"
then
save "$home/imap/<domein>/<mailbox>/Maildir/.<foldernaam>/"
endif
This automatically saves messages with these words in the subject to the folder concerned. For <domein> enter the domain name (e.g. example.com). For <mailbox> enter the name of the mailbox (created via POP3 accounts in DirectAdmin). So if the email address is jan@example.com, enter jan there and nothing more. For <foldernaam> enter the name of the folder you created, for example via webmail. Note that it must start with a dot.
if $header_to: contains "jan@example.com"
then
save "$home/imap/<domein>/<mailbox>/Maildir/.<foldernaam>/"
endif
Similar to the previous example, but now all messages sent to the TO address are saved in the folder concerned.
You can find more information about these filters here:
http://www.exim.org/exim-html-4.50/doc/html/filter_toc.html
