[Mimedefang] Add header to be auto moved into outlook junk folder

David Both dboth at millennium-technology.com
Mon May 16 19:27:05 EDT 2011



Here is the modified code I use in mimedefang-filter. I add a different message ("Probably Spam" and "Possibly Spam") in the Subject line depending upon the score. I also add "Probably" "Possibly" and "No" to the X-Spam-Status header. Now any email client with filters can act upon it in various ways. You may want to change the values being tested against the variable $hits for your environment.

I hope this helps.


            #####################################################################
            # Determine how to handle the email based on its spam score  and    #
            # add an appropriate X-Spam-Status header and alter the subject.    #
            #####################################################################
            if ($hits >= 6.7) {
                # The following header is used by some email clients to display a SpamAssassin score
                # in the fancy message headers. This is the minimum required format for this to work.
                action_change_header("X-Spam-Status", "Yes, score=$hits required=$req tests=$names");
                # If over a score as set above we delete the message
                action_discard();
            } elsif ($hits >= $req) {
                # The following header is used by some email clients to display a SpamAssassin score
                # in the fancy message headers. This is the minimum required format for this to work.
                action_change_header("X-Spam-Status", "Probably, score=$hits required=$req tests=$names");
                # Add a message to the subject
                action_change_header("Subject", "****Probably SPAM**** ($hits) $Subject");
                md_graphdefang_log('spam', $hits, $RelayAddr);

                # If you find the SA report useful, add it, I guess...
                action_add_part($entity, "text/plain", "-suggest",
                                "$report\n",
                                "SpamAssassinReport.txt", "inline");
            } elsif ($hits >= 3) {
                # The following header is used by some email clients to display a SpamAssassin score
                # in the fancy message headers. This is the minimum required format for this to work.
                action_change_header("X-Spam-Status", "Possibly, score=$hits required=$req tests=$names");
                # Add a message to the subject
                action_change_header("Subject", "****Possibly SPAM**** ($hits) $Subject");
                md_graphdefang_log('spam', $hits, $RelayAddr);

                # If you find the SA report useful, add it, I guess...
                action_add_part($entity, "text/plain", "-suggest",
                                "$report\n",
                                "SpamAssassinReport.txt", "inline");

            } else {
                # If score (hits) is less than 3
                # The following header is used by some email clients to display a SpamAssassin score
                # in the fancy message headers. This is the minimum required format for this to work.
                action_change_header("X-Spam-Status", "No, score=$hits required=$req tests=$names");
            }


-- 


*********************************************************
David P. Both, RHCE
Millennium Technology Consulting LLC
919-389-8678

dboth at millennium-technology.com

www.millennium-technology.com 
www.databook.bz - Home of the DataBook for Linux
DataBook is a Registered Trademark of David Both


On Monday, May 16, 2011 17:13:53 Scott Ostrander wrote:
> 
> We are using MimeDefang and SpamAssassin.
> This setup is doing a great job.
> 
> Google is coming up short in finding info about Outlook Junk filter workings.
> For various internal reasons we have a range of emails that are not clearly defined as Spam. (the users want these emails, just not in their inbox)
> Does anyone know of a header I can add with MimeDefang that the Outlook 2010 Junk filter will react to and move the email into the Junk folder?
> I know how to add rules in Outlook to move emails tagged as Spam into the Junk folder by looking at the X-Spam-Score header.  I was hoping to avoid adding rules for each end user.
> 
> Regards,
> Scott
> _______________________________________________
> NOTE: If there is a disclaimer or other legal boilerplate in the above
> message, it is NULL AND VOID.  You may ignore it.
> 
> Visit http://www.mimedefang.org and http://www.roaringpenguin.com
> MIMEDefang mailing list MIMEDefang at lists.roaringpenguin.com
> http://lists.roaringpenguin.com/mailman/listinfo/mimedefang
> 



More information about the MIMEDefang mailing list