{"id":757,"date":"2017-09-15T07:47:00","date_gmt":"2017-09-15T05:47:00","guid":{"rendered":"https:\/\/schaal-it.dev\/en\/?p=757"},"modified":"2023-11-28T08:04:42","modified_gmt":"2023-11-28T07:04:42","slug":"spammail-understand-header-and-move-mails","status":"publish","type":"post","link":"https:\/\/schaal-it.dev\/en\/blog\/spammail-understand-header-and-move-mails\/","title":{"rendered":"Spammail understand header and move mails"},"content":{"rendered":"\n<p>Various scanners can be used to scan incoming and outgoing mail. For example, ISPConfig uses SpamAssassin, ClamAV and Amavis. The individual threshold values (more on this later) can be defined individually.<\/p>\n\n\n\n<p>To prevent spammers from appearing in the inbox, you can automatically move mails to a separate folder based on an individual spam value. This makes spam mails visible via an IMAP client or a webmailer and reduces the risk of not seeing a mail mistakenly identified as spam.<\/p>\n\n\n\n<p>Caution: when the mails are picked up using POP3, the moved mails will not be retrieved. They are no longer in the inbox, but in a subfolder. This moving is always done directly on the server.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Scan Procedure<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>postfix receives the mail<\/li>\n\n\n\n<li>and relays the mail to amavis<\/li>\n\n\n\n<li>on the basis of different spam rules (see also current rules for SpamAssassin from schaal @it) the mail gets different information in the header<\/li>\n\n\n\n<li>Amavis sends the mail back to Postfix<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Structure of a mailheader<\/h2>\n\n\n\n<p>We deliberately leave out most of the entries from a mailheader because they are not relevant for detecting or moving spam. The essential lines of a mail header see e.g. like this: <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>X-Virus-Scanned: Debian amavisd-new at scan.schaal-it.net \nX-Spam-Flag: YES \nX-Spam-Score: 7.039 \nX-Spam-Level: ******* \nX-Spam-Status: Yes, score=7.039 tagged_above=3 required=5 tests=&#91;BAYES_50=0.8, DATE_IN_PAST_24_48=1.34, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RP_MATCHES_RCVD=-0.001, SCHAALIT_HEADER_964=5] autolearn=no<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">X-Virus-Scanned<\/h3>\n\n\n\n<p>The first line shows which scanner was used. If you want other information, you can adjust the Amavis-Config accordingly. For Debian or Ubuntu, this would be $ X_HEADER_LINE in \/etc\/amavis\/conf.d\/20-debian_defaults.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">X-Spam-Flag<\/h3>\n\n\n\n<p>If this is set to YES, the mail was classified as spam.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">X-Spam-Score<\/h3>\n\n\n\n<p>The X-Spam score is the value that SpamAssassin has determined based on its filter rules for the mail. In ISPConfig, you can define the value from which a mail should be marked as spam (5.00 for Trigger happy) under Policy &#8211; Spamfilter policy &#8211; Tag Level in the &#8220;SPAM tag2 level&#8221; field.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">X-Spam-Level<\/h3>\n\n\n\n<p>This is the integer value of X-Spam-Score in * &#8211; in our case, the score is 7.039 and thus there are seven asterisks. You can use the value with your own filter, if you do not want to take the X-Spam-Score.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">X-Spam-Status<\/h3>\n\n\n\n<p><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">Yes, score=7.039<\/mark> this is the same as in X-Spam&#8217;s flag and X-Spam score.<\/p>\n\n\n\n<p><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">tagged_above=3<\/mark> specifies the value from which these lines listed here should be inserted into the header. For ISPConfig, this is the &#8220;SPAM tag level&#8221; for the Spamfilter policy.<\/p>\n\n\n\n<p><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">required=5<\/mark> is the value from which the mail is then marked as spam and the X-Spam flag is set to YES. For the Spamfilter policy, this is the &#8220;SPAM tag2 level&#8221;<\/p>\n\n\n\n<p><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">tests=<\/mark> shows you which individual rules SpamAssassin has applied and how many points have been set for this mail:<\/p>\n\n\n\n<p>BAYES_50, DATE_IN_PAST_24_48 and SCHAALIT_HEADER_964 have increased the value, the signing with DKIM has reduced the score by a total of 0.1 (DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU) and RP_MATCHES_RCVD has decreased the value by 0.001.<\/p>\n\n\n\n<p>overall, therefore:<\/p>\n\n\n\n<p>0.8 + 1.34 + 5 = 7.14<\/p>\n\n\n\n<p>0.1 &#8211; 0.1 &#8211; 0.1 = -0,1<\/p>\n\n\n\n<p>&#8211; 0.001<\/p>\n\n\n\n<p>And this brings us to score of 7.039<\/p>\n\n\n\n<p>If you are interested in the contents of the tests, you can find the rules in different folders in \/var\/lib\/spamassassin. As an example we take the rule SCHAALIT_HEADER_964:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>header SCHAALIT_HEADER_964 \nFrom =~ \/\\@pkv.*\\.(online|net|com|org|co|info|de)\/ \ndescribe SCHAALIT_HEADER_964 schaal @it Spam Header-964 \nscore SCHAALIT_HEADER_964 5<\/code><\/pre>\n\n\n\n<p>The rule applies to the from line in the mail. In doing so, a RegEx is used, which spans various spam mails on the subject of german private health insurance.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Move the mail to the spam folder<\/h2>\n\n\n\n<p>After Postfix has returned the mail from Amavis (see Scan Procedure), the mail is either sent, or &#8211; if the recipient is one of our users &#8211; delivered via Dovecot into the mailbox.<\/p>\n\n\n\n<p>The local delivery of the mail by Dovecot is one of the decisive points: if the mail was previously marked as spam by SpamAssassin, it is not moved to the inbox, but to the subfolder Junk. For ISPConfig, the checkbox for the email account in the email filters must be set to &#8220;Move Spam Emails to Junk directory&#8221;.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Basics about the filters with ISPConfig<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>A spam filter must be selected for the domain or mailbox. If a filter is defined for the domain and the mailbox, the settings from the mailbox are in place. If only the domain has a filter, it&#8217;s also used for the mailbox. In short: Mailbox overwrites domain &#8211; this is the only way, to define individual policies for each mailbox. If you use an alias, the policy for the domain applies.<\/li>\n\n\n\n<li>The selected spam filter must be defined in such a way that the corresponding values also &#8220;fit&#8221; to the mail. If our filter had a &#8220;SPAM tag2 level&#8221; of 10, the mail would not be marked as spam.<\/li>\n\n\n\n<li>Spam-mails will only be moved if &#8220;Move Spam Emails to Junk directory&#8221; is set.<\/li>\n\n\n\n<li>Only the administrator can change or create policies. If every user had the possibility, this would affect all the mailboxes that use this filter. If you are in doubt, you better suggest an additional guideline.<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>Various scanners can be used to scan incoming and outgoing mail. For example, ISPConfig uses SpamAssassin, ClamAV and Amavis. The individual threshold values (more on&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-757","post","type-post","status-publish","format-standard","hentry","category-blog"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v23.9 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Spammail understand header and move mails<\/title>\n<meta name=\"description\" content=\"Various scanners make it easier to analyze incoming and outgoing emails. Here we show you how you can filter emails.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/schaal-it.dev\/en\/blog\/spammail-understand-header-and-move-mails\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Spammail understand header and move mails\" \/>\n<meta property=\"og:description\" content=\"Various scanners make it easier to analyze incoming and outgoing emails. Here we show you how you can filter emails.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/schaal-it.dev\/en\/blog\/spammail-understand-header-and-move-mails\/\" \/>\n<meta property=\"og:site_name\" content=\"schaal @it UG\" \/>\n<meta property=\"article:published_time\" content=\"2017-09-15T05:47:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-11-28T07:04:42+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/schaal-it.dev\\\/en\\\/blog\\\/spammail-understand-header-and-move-mails\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/schaal-it.dev\\\/en\\\/blog\\\/spammail-understand-header-and-move-mails\\\/\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\\\/\\\/schaal-it.dev\\\/en\\\/#\\\/schema\\\/person\\\/97112bea38186367c303945fe91f1101\"},\"headline\":\"Spammail understand header and move mails\",\"datePublished\":\"2017-09-15T05:47:00+00:00\",\"dateModified\":\"2023-11-28T07:04:42+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/schaal-it.dev\\\/en\\\/blog\\\/spammail-understand-header-and-move-mails\\\/\"},\"wordCount\":813,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/schaal-it.dev\\\/en\\\/#organization\"},\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/schaal-it.dev\\\/en\\\/blog\\\/spammail-understand-header-and-move-mails\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/schaal-it.dev\\\/en\\\/blog\\\/spammail-understand-header-and-move-mails\\\/\",\"url\":\"https:\\\/\\\/schaal-it.dev\\\/en\\\/blog\\\/spammail-understand-header-and-move-mails\\\/\",\"name\":\"Spammail understand header and move mails\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/schaal-it.dev\\\/en\\\/#website\"},\"datePublished\":\"2017-09-15T05:47:00+00:00\",\"dateModified\":\"2023-11-28T07:04:42+00:00\",\"description\":\"Various scanners make it easier to analyze incoming and outgoing emails. Here we show you how you can filter emails.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/schaal-it.dev\\\/en\\\/blog\\\/spammail-understand-header-and-move-mails\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/schaal-it.dev\\\/en\\\/blog\\\/spammail-understand-header-and-move-mails\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/schaal-it.dev\\\/en\\\/blog\\\/spammail-understand-header-and-move-mails\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Startseite\",\"item\":\"https:\\\/\\\/schaal-it.dev\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Spammail understand header and move mails\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/schaal-it.dev\\\/en\\\/#website\",\"url\":\"https:\\\/\\\/schaal-it.dev\\\/en\\\/\",\"name\":\"schaal @it UG\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/schaal-it.dev\\\/en\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/schaal-it.dev\\\/en\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/schaal-it.dev\\\/en\\\/#organization\",\"name\":\"schaal@it UG\",\"url\":\"https:\\\/\\\/schaal-it.dev\\\/en\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/schaal-it.dev\\\/en\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/schaal-it.dev\\\/en\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/10\\\/cropped-schaal_it_logo2_2_-_250px.png\",\"contentUrl\":\"https:\\\/\\\/schaal-it.dev\\\/en\\\/wp-content\\\/uploads\\\/sites\\\/2\\\/2023\\\/10\\\/cropped-schaal_it_logo2_2_-_250px.png\",\"width\":250,\"height\":42,\"caption\":\"schaal@it UG\"},\"image\":{\"@id\":\"https:\\\/\\\/schaal-it.dev\\\/en\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/schaal-it.dev\\\/en\\\/#\\\/schema\\\/person\\\/97112bea38186367c303945fe91f1101\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d608e74bb5cd2c03fa61fb269810c56ac375940d126f01ea5954cc0a1336e0dc?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d608e74bb5cd2c03fa61fb269810c56ac375940d126f01ea5954cc0a1336e0dc?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d608e74bb5cd2c03fa61fb269810c56ac375940d126f01ea5954cc0a1336e0dc?s=96&d=mm&r=g\",\"caption\":\"admin\"},\"sameAs\":[\"https:\\\/\\\/schaal-it.dev\"],\"url\":\"https:\\\/\\\/schaal-it.dev\\\/en\\\/author\\\/admin\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Spammail understand header and move mails","description":"Various scanners make it easier to analyze incoming and outgoing emails. Here we show you how you can filter emails.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/schaal-it.dev\/en\/blog\/spammail-understand-header-and-move-mails\/","og_locale":"en_US","og_type":"article","og_title":"Spammail understand header and move mails","og_description":"Various scanners make it easier to analyze incoming and outgoing emails. Here we show you how you can filter emails.","og_url":"https:\/\/schaal-it.dev\/en\/blog\/spammail-understand-header-and-move-mails\/","og_site_name":"schaal @it UG","article_published_time":"2017-09-15T05:47:00+00:00","article_modified_time":"2023-11-28T07:04:42+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/schaal-it.dev\/en\/blog\/spammail-understand-header-and-move-mails\/#article","isPartOf":{"@id":"https:\/\/schaal-it.dev\/en\/blog\/spammail-understand-header-and-move-mails\/"},"author":{"name":"admin","@id":"https:\/\/schaal-it.dev\/en\/#\/schema\/person\/97112bea38186367c303945fe91f1101"},"headline":"Spammail understand header and move mails","datePublished":"2017-09-15T05:47:00+00:00","dateModified":"2023-11-28T07:04:42+00:00","mainEntityOfPage":{"@id":"https:\/\/schaal-it.dev\/en\/blog\/spammail-understand-header-and-move-mails\/"},"wordCount":813,"commentCount":0,"publisher":{"@id":"https:\/\/schaal-it.dev\/en\/#organization"},"articleSection":["Blog"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/schaal-it.dev\/en\/blog\/spammail-understand-header-and-move-mails\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/schaal-it.dev\/en\/blog\/spammail-understand-header-and-move-mails\/","url":"https:\/\/schaal-it.dev\/en\/blog\/spammail-understand-header-and-move-mails\/","name":"Spammail understand header and move mails","isPartOf":{"@id":"https:\/\/schaal-it.dev\/en\/#website"},"datePublished":"2017-09-15T05:47:00+00:00","dateModified":"2023-11-28T07:04:42+00:00","description":"Various scanners make it easier to analyze incoming and outgoing emails. Here we show you how you can filter emails.","breadcrumb":{"@id":"https:\/\/schaal-it.dev\/en\/blog\/spammail-understand-header-and-move-mails\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/schaal-it.dev\/en\/blog\/spammail-understand-header-and-move-mails\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/schaal-it.dev\/en\/blog\/spammail-understand-header-and-move-mails\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Startseite","item":"https:\/\/schaal-it.dev\/en\/"},{"@type":"ListItem","position":2,"name":"Spammail understand header and move mails"}]},{"@type":"WebSite","@id":"https:\/\/schaal-it.dev\/en\/#website","url":"https:\/\/schaal-it.dev\/en\/","name":"schaal @it UG","description":"","publisher":{"@id":"https:\/\/schaal-it.dev\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/schaal-it.dev\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/schaal-it.dev\/en\/#organization","name":"schaal@it UG","url":"https:\/\/schaal-it.dev\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/schaal-it.dev\/en\/#\/schema\/logo\/image\/","url":"https:\/\/schaal-it.dev\/en\/wp-content\/uploads\/sites\/2\/2023\/10\/cropped-schaal_it_logo2_2_-_250px.png","contentUrl":"https:\/\/schaal-it.dev\/en\/wp-content\/uploads\/sites\/2\/2023\/10\/cropped-schaal_it_logo2_2_-_250px.png","width":250,"height":42,"caption":"schaal@it UG"},"image":{"@id":"https:\/\/schaal-it.dev\/en\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/schaal-it.dev\/en\/#\/schema\/person\/97112bea38186367c303945fe91f1101","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/d608e74bb5cd2c03fa61fb269810c56ac375940d126f01ea5954cc0a1336e0dc?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/d608e74bb5cd2c03fa61fb269810c56ac375940d126f01ea5954cc0a1336e0dc?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d608e74bb5cd2c03fa61fb269810c56ac375940d126f01ea5954cc0a1336e0dc?s=96&d=mm&r=g","caption":"admin"},"sameAs":["https:\/\/schaal-it.dev"],"url":"https:\/\/schaal-it.dev\/en\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/schaal-it.dev\/en\/wp-json\/wp\/v2\/posts\/757","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/schaal-it.dev\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/schaal-it.dev\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/schaal-it.dev\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/schaal-it.dev\/en\/wp-json\/wp\/v2\/comments?post=757"}],"version-history":[{"count":1,"href":"https:\/\/schaal-it.dev\/en\/wp-json\/wp\/v2\/posts\/757\/revisions"}],"predecessor-version":[{"id":758,"href":"https:\/\/schaal-it.dev\/en\/wp-json\/wp\/v2\/posts\/757\/revisions\/758"}],"wp:attachment":[{"href":"https:\/\/schaal-it.dev\/en\/wp-json\/wp\/v2\/media?parent=757"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/schaal-it.dev\/en\/wp-json\/wp\/v2\/categories?post=757"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/schaal-it.dev\/en\/wp-json\/wp\/v2\/tags?post=757"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}