Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there any filter which would allow me to have the plain or html text body synopsis (preview) in the mail header as well? Like SpamAssassin does for spam emails (it inserts X-Spam-Report header with Content preview section) but more flexible/configurable and for all kinds of mails, not only spam ones.

I want to display message list in Gmail manner so that Subject is followed by the first line of the text body (in case if the body is HTML, this text line should be stripped of HTML tags and so on). Although it's possible to implement this via a number of pretty complex IMAP queries, I would prefer to keep this simple, like getting a header value.

Or, maybe, spamassassin itself can be configured for that?

share|improve this question

closed as not constructive by John Gardeniers, Ward, Michael Hampton, mdpc, Khaled Jan 5 '13 at 8:10

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

up vote 0 down vote accepted

If you can configure SpamAssassin to put a preview in its spam report, then use exim's ACL system to put that preview in every message instead of just the spams. By that I mean don't put the report in based on the score, put the report in every message and only REJECT if the score is above your maximum threshold. Here's an example of how I do it:

  # Always add X-Spam-Score and X-Spam-Report headers
  # using SA system-wide settings (user "exim")
  # no matter if over threshold or not.
  warn    condition      = ${if >{$message_size}{500K}{no}{yes}}
          !authenticated = *
          spam           = exim:true
          add_header     = X-Spam-Score: $spam_score
          add_header     = X-Spam-Report: $spam_report
          message        = X-Spam-Score: $spam_score\n\
                           X-Spam-Report: $spam_report

  # Add X-Spam-Flag if spam is over system-wide threshold
  warn    condition      = ${if >{$message_size}{500K}{no}{yes}}
          !authenticated = *
          message        = X-Spam-Flag: Yes
          spam           = exim
          add_header     = X-Spam-Flag: Yes

  # Reject spams with score over 6
  deny    condition      = ${if >{$message_size}{500K}{no}{yes}}
          !authenticated = *
          message        = This message scored $spam_score points.  Rejected.
          spam           = exim:true
          condition      = ${if >{$spam_score_int}{60}{1}{0}}

In your case, you need to add the _ PREVIEW _ display flag in your to create a header named X-Spam-Content-Preview:

add_header all Content-Preview _PREVIEW_

Then configure your app to look for and display that header.

share|improve this answer
Will give it a try, thanks! – Alex Jan 5 '13 at 8:42

Not the answer you're looking for? Browse other questions tagged or ask your own question.