CNET también está disponible en español.

Ir a español

Don't show this again


Tip: Use custom headers to expand rule options in Mail

The junk filters available for Mail may not always identify spam, and while you can create your own junk mail rules, sometimes messages uses custom header information. Here is how to use those headers in a rule.

While Mail has a built-in junk filter and also has support for third-party junk filters, there are times when certain spam will continually get by these filters. Usually when this happens you can create a special rule for the offending messages to automatically move them to the junk mail folder or trash, but sometimes junk mail may do a good job at hiding its origin. Despite this, you might be able to find a common feature among similar junk mail messages by looking at the message's extended header information, but then have no way to isolate it in a rule.

One example of this came up today on the Apple Support Communities Web site by user "kludged":

I keep getting spam from different email addresses, and different ip addresses that have a common look and feel...What I find is that the in the long header "received from" usually identifies "unknown" as part of the host. Can I use this in a email filter to eliminated all received email from an unknown IP address?...this particular message not only fails the junk mail tests, but I also have spam sieve installed and it fails spam sieve.

If you find a common aspect of junk mail in an obscure header field, you can create a rule for it by adding a new message header. In this case "kludged" found a common component in the "Received" header, but this is not included by default as an option to use when making rules in Mail. However, you can have Mail recognize it by adding it as a custom message header.

To do this, go to Mail's preferences and click the Rules section. Then click the Add Rule button and when the new rule window pops up, select "Edit Header List..." from the criteria list menu (this menu usually says "Any Recipient" by default). In the custom header list window that appears, click the plus sign and then type the exact name of the header you wish to add. Examples of these can be: Delivered-To, Received, Message-Id, Content-Type, Content-Language, among numerous other common and unique headers.

The specifics will depend on the messages you are receiving, but you can see the options for your message by viewing it and then going to the View > Message menu and choosing the option to show long headers for the message.

With the desired headers now entered in Mail's header list, you can then use them in a rule to isolate specific content and perform various actions on the messages whose headers contain that content.

Questions? Comments? Have a fix? Post them below or e-mail us!
Be sure to check us out on Twitter and the CNET Mac forums.