Email filtering is the processing of email to organize it according to specified criteria. Most often this refers to the automatic processing of incoming messages, but the term also applies to the intervention of human intelligence in addition to anti-spam techniques, and to outgoing emails as well as those being received.
Email filtering software inputs email. For its output, it might pass the message through unchanged for delivery to the user's mailbox, redirect the message for delivery elsewhere, or even throw the message away. Some mail filters are able to edit messages during processing.
Common uses for mail filters include organising incoming email and removal of spam and computer viruses. A less common use is to inspect outgoing email at some companies to ensure that employees comply with appropriate laws. Users might also employ a mail filter to prioritize messages, and to sort them into folders based on subject matter or other criteria.
Mail filters can be installed by the user, either as separate programs (see links below), or as part of their email program (email client). In email programs, users can make personal, "manual" filters that then automatically filter mail according to the chosen criteria. Most email programs now also have an automatic spam filtering function. Internet service providers can also install mail filters in their mail transfer agents as a service to all of their customers. Due to the growing threat of fraudulent websites Internet service providers filter URLs in email messages to remove the threat before users click. Corporations often use filters to protect their employees and their information technology assets.
Inbound and Outbound Filtering 
Mail filters can operate on inbound and outbound email traffic. Inbound email filtering involves scanning messages from the Internet addressed to users protected by the filtering system or for lawful interception. Outbound email filtering involves the reverse - scanning email messages from local users before any potentially harmful messages can be delivered to others on the Internet. One method of outbound email filtering that is commonly used by Internet service providers is transparent SMTP proxying, in which email traffic is intercepted and filtered via a transparent proxy within the network. Outbound filtering can also take place in an email server. Many corporations employ data leak prevention technology in their outbound mail servers to prevent the leakage of sensitive information via email.
Mail filters have varying degrees of configurability. Sometimes they make decisions based on matching a regular expression. Other times, keywords in the message body are used, or perhaps the email address of the sender of the message. Some more advanced filters, particularly anti-spam filters, use statistical document classification techniques such as the naive Bayes classifier. Image filtering can also be used that use complex image analysis algorithms to detect skin-tones and specific body shapes normally associated with adult-images (pornographic images).
See also 
- Anti-Spam SMTP Proxy
- Outbound Spam Protection
- Bayesian spam filtering
- b8 (spam filter)
- information filtering
- Maildrop is an MDA (Mail Delivery Agent) for Unix systems.
- Markovian discrimination
- Policyd-weight Postfix policy-daemon before SMTP DATA
- Procmail is an MDA (Mail Delivery Agent) for Unix systems.
- Sendmail supports libmilter for mail filtering
- Sieve (mail filtering language) is an RFC standard for describing mail filters
- Spam Reader
- White list#Email whitelists
- Zonk. "How Pervasive is ISP Outbound Email Filtering?". Slashdot.org. Slashdot.org. Retrieved 15 September 2011.