-1

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?

Alex
  • 113
  • 5

1 Answers1

0

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 local.cf 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.

Todd Lyons
  • 2,006
  • 16
  • 12