KB / Account Control Panel / Mail :: Filters

From DreamHost

Jump to: navigation, search

Contents

Parent Article

Sub-Articles

Setting up mail filters

You can use our mail filters to intercept email containing a certain string of text. Uses for this could be to automatically delete email from an abusive sender, move email from a mailing list to a certain IMAP folder, or forward mail containing a certain string of text to another email address.

We recommend only using our special Razor Spam filter to attempt to filter spam. Just trying to block spam based on certain words in the subject/body/sender of messages usually doesn't work very well and can result in a lot of non-spam being accidentally filtered!

To use mail filters, they must first be set up. To do so, go to the "Mail :: Filters" section of the web panel:

['https://panel.dreamhost.com/index.cgi?tree=mail.filters' https://panel.dreamhost.com/index.cgi?tree=mail.filters]

If you have any filters, they will be listed here. If not, you will need to add one (see Adding Filters, below).

Viewing Current Filters

On the right side of each filter listed you can choose to edit or delete it. Using the 'Up' and 'Down' items, you can also change the order in which filters are executed (topmost filters are executed first, which lower filters executed thereafter).

The order in which filters execute can be important, as email messages captured by early filters won't be seen at all by later ones.

Adding Filters

If you don't have filters (or you do but want to create another), you must choose the mailbox you wish to add a filter to and click on the 'Go' button. Once you have done so, you will see the filter editor.

First, choose the portion of the email address you wish to search for text in. Current choices include the Subject, From, To, and CC headers - as well as the content of the message itself. Next, type the text you wish to search for.

After that, you must define what you wish to do with messages that match the criteria defined above. If a message matches, you have three choices of actions to do to it:

- Move it to an IMAP folder - Redirect it to an email address - Delete it

The latter two are fairly self explanatory, and won't be covered here except in that if you choose the forwarding option you must provide a valid email address in the field provided.

The first option - moving it to an IMAP folder - moves the message to a sub-folder that can be viewed if you currently use IMAP with your email client.

If you have other filters defined for this mailbox, you'll also be asked to define at what point you wish the filter to execute. Simply click on the radio button where you want it to run, and it will do so there.

When you are finished, click 'Add Filter'. You will be returned to the email filter listing.

How do the DreamHost mail filters actually work?

Whenever you set up a mail filter on a mailbox hosted with us through our web panel, you trigger our system to generate for you a custom procmail set up for you. If you already know about procmail and are using it on your mailbox/user, our web-panel mail filters will not work!

When you add the Razor filter to a mailbox, the following is added to the generated .procmailrc:
 # filter 0 - first tag message with razor :0 Wc | razor-check # filter 0 :0 Wa .dh-spam/ 
So, if you want, you can actually set up razor on a mailbox without using our web interface to do it. But you've got to already know what you're doing with procmail!

Filtering e-mail sent to invalid accounts

These filters can also be used to forward normally undeliverable mail when used with a "catch-all" account. First, create a mail account named "catch-all" for your domain. Then, create a new set of filters that process these messages. For example, you could create a filter that forwards any message addressed to fwd-bank@yourdomain.com by directing messages To: "fwd-" be delivered to an existing mail account. This can be useful if you don't want to give out your real address, but still want the mail delivered to a valid account. Each user account would need an identifying prefix string to match their forwarding alias.

You will want to set the disk limit fairly small for the "catch-all" account, as it will likely accrue a lot of junk e-mail. Note that senders will no longer receive bounced mail messages for accounts that don't exist on your domain.

Personal tools