[exim] How to Auto Decode RFC2047 Messages

Pàgina inicial
Delete this message
Reply to this message
Autor: Craig Whitmore
Data:  
A: exim-users
Assumpte: [exim] How to Auto Decode RFC2047 Messages
Hi There

I am trying to write an auto decoder for RFC2047 Messages (AKA
Auto-Forwarded Message as Attachment) system in exim.
For example..

Someone Gets Spam
They "forward as attachment" the message to report@???
exim decodes the message (or messages) forwarded and places them into a
Folder
so I can do something with them later
Like Spamcop does when you report spam

I am doing the decoding externally at the moment with a program at the
moment via below but has a few problems
- Cannot report multiple emails at once (only 1 at a time)
- Adds Extra Received Header + others into header so I don't get the
"pristene" message into the folder (but very close)

The question is.. how can I do all this (in a nice way) within exim and not
call external programs.
Has anyone done this before?

Thanks
Craig


-------------------------------------------------------------------------------
Stuff removed to make shorter...

reported_spam:
  condition = "${if and { \
                {def:h_X-Reported-Spam:} \
                {!eq {$received_protocol}{local}} \
                } \
                {1}{0}}"
  driver = accept
  transport = decode_spam


decode_spam:
driver = pipe
command = "/etc/exim4/decode2047.pl $sender_address $local_part@$domain"

virtual_domains_reported:
condition = ${if
match{$local_part@$domain}{report@???}{true}{false}}
driver = accept
transport = mail_spool_reported

mail_spool_reported:
debug_print = "Reported Spam: domain = $domain localuser = $local_part"
driver = appendfile
directory = /mail/${lookup mysql {BOXNAME}{$value}}/Maildir/.Reported Spam

/etc/exim4/decode2047.pl (somthing I wrote) decodes it and pipes it thru
/usr/sbin/exim4 -f $fromemail -bm $toemail
(fromemail = $1 toemail = $2)