martin f krafft | 2 Nov 2007 19:20

decoding non-ascii subject lines

Hi folks,

I sometimes get mail with a raw subject line like this:

  Subject: =?iso-8859-1?q?ilpostino=2Ejpberlin=2Ede_Mitgliedschafts-Erinner?=
   =?iso-8859-1?q?ung?=

Do you know of a good way to convert this within procmail so that
I can use filtering expressions that work on the expanded, non-ascii
text? I've had a brief look around, but short of a Python or Perl
parser, could not find any tool to do this. What do you do?

--

-- 
martin | http://madduck.net/ | http://two.sentenc.es/

"my father, a good man, told me:
'never lose your ignorance; you cannot replace it.'"
                                               -- erich maria remarque

spamtraps: madduck.bogus <at> madduck.net
____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail <at> lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail
Alan Clifford | 3 Nov 2007 03:20
Favicon

Re: decoding non-ascii subject lines

On Fri, 2 Nov 2007, martin f krafft wrote:

mfk> Hi folks,
mfk> 
mfk> I sometimes get mail with a raw subject line like this:
mfk> 
mfk>   Subject: 
mfk> =?iso-8859-1?q?ilpostino=2Ejpberlin=2Ede_Mitgliedschafts-Erinner?=
mfk>    =?iso-8859-1?q?ung?=
mfk> 
mfk> Do you know of a good way to convert this within procmail so that
mfk> I can use filtering expressions that work on the expanded, non-ascii
mfk> text? I've had a brief look around, but short of a Python or Perl
mfk> parser, could not find any tool to do this. What do you do?
mfk> 

I don't have a solution but maybe a start towards one.

I have a recipe that starts with 

# B Mime header extension in subject?
:0 
* ^Subject:.*=\?.*\?b\?\/.+\?=
{
  MIMESUBJECT=`echo $MATCH | mimencode -u -b`

I think that if you changed the \?b\? to \?q\? and the -b to -q then 
MIMESUBJECT would have the decoded text of the first bit. You would need 
to hack off the bit after the ?= before doing this.  

(Continue reading)

Matthias Häker | 3 Nov 2007 11:26
Picon

Re: decoding non-ascii subject lines


martin f krafft schrieb:
> Hi folks,
>
> I sometimes get mail with a raw subject line like this:
>
>   Subject: =?iso-8859-1?q?ilpostino=2Ejpberlin=2Ede_Mitgliedschafts-Erinner?=
>    =?iso-8859-1?q?ung?=
>
> Do you know of a good way to convert this within procmail so that
> I can use filtering expressions that work on the expanded, non-ascii
> text? I've had a brief look around, but short of a Python or Perl
> parser, could not find any tool to do this. What do you do?
>
>   

Hi

i found this on the Web

http://www.xs4all.nl/~rvtol/procmail/archive/

and the 101_bq.zip

contains what you need.

i use it this way

:0
* SUBJECT ?? ()\/.*=\?[a-z0-9-]+\?[bq]\?[^?]+\?=.*
(Continue reading)

Udi Mottelo | 4 Nov 2007 10:02
Picon
Picon

Re: decoding non-ascii subject lines


 	(P L E A S E    with no attachmnt!!!!!)

 	Now, to my procmailrc:

SUBJ=| formail -xSubject:

   ...
* SUBJ ?? ()\?=\?(iso-8859-1|utf-8)\?\/..[^\?]*
{
         :0
         * MATCH ?? B\?\/[^\?]*
         { BBB=`echo $MATCH | mimencode -u | cat -v` }

         :0
         * MATCH ?? Q\?\/[^\?]*
         { QQQ=`echo $MATCH | mimencode -u -q | cat -v` }

         TEXT="$QQQ$BBB"
}

 	The  ''cat -v``  is for "outer" characters.

Bye,
  Udi

Hi folks,

(Continue reading)

Xesc Arbona | 5 Nov 2007 10:41
Favicon

RE: Append header in undelivered messages

> Xesc Arbona wrote Thursday, October 18, 2007 6:48 PM:
> 
> > [Dallman Ross wrote:]
> > > I suggest you use X-Loop.  It's canonical, it's well-documented
> > > (see the procmailex man pages), and the header ought to persist 
> > > in this use.  If you see your X-Loop, you know it's been seen 
> > > by your procmail setup and you can you can skip the cache check.
> > 
> > Thanks! I'll use it. However, I found another problem when 
> > trying to add the header:
> > 
> > procmail: Program failure (75) of "/usr/bin/zarafa-dagent"
> > procmail: Assigning "LASTFOLDER=/usr/bin/zarafa-dagent xesca"
> > procmail: Assigning "EXITCODE=75"
> > procmail: Match on ! "^X-Loop: $RECIPIENT <at> .*"
> > procmail: Executing " (formail -I Delivered-To -A "X-Loop: 
> > $RECIPIENT <at> topdesk.com") | $SENDMAIL -oi -t"
> > procmail: Error while writing to " (formail -I Delivered-To 
> > -A "X-Loop: $RECIPIENT <at> topdesk.com") | $SENDMAIL -oi -t"
> > procmail: Rescue of unfiltered data succeeded
> > procmail: Assigning "LASTFOLDER=/home/vmail/msg.Mkh"
> > procmail: Opening "/home/vmail/msg.Mkh"
> > 
> > If I try to pipe the message manually, it works:
> > 
> > cat /home/vmail/msg.Mkh | formail -I Delivered-To -A "X-Loop: 
> > xesca <at> topdesk.com") | $SENDMAIL -oi -t
> > 
> > What could be the problem? How can I get an even more 
> verbose output?
(Continue reading)

Rene Borchers | 5 Nov 2007 18:49
Picon

Re: Append header in undelivered messages

Hi,

I've changed distributions and now I  have the following problem:

When I use procmail to forward a mail with

:0
* ^From.*a_user <at> domain
! other_account <at> anotherdomain

The mail is forwarded, but it is a complete new mail the old mail is in
the body of the mail including headers and attachments. For the
receiving side the mail is completely worthless. With my previous
distribution it was forwarded as received only a ReSent header was
added.

any idea's to solve this

Thanks in advance

Rene
--

-- 
------------------------------------------------------
Registered Linux User No.291649 http://www.linux-counter.org
Registered LFS user No.16792 http://www.linuxfromscratch.org
Uptime: 18:37:54 up 91 days, 11:43, 4 users, load average: 0.00, 0.02, 0.00
Kernel: Linux 2.6.18.6.tex1 GNU/Linux
Processor: model name : Intel(R) Pentium(R) 4 CPU 2.60GHz
web: http://rene-borchers.homelinux.com
------------------------------------------------------
(Continue reading)

Rene Borchers | 5 Nov 2007 18:53
Picon

Excuse


Sorry, guys pushed the wrong buttons to create the post

Rene
--

-- 
------------------------------------------------------
Registered Linux User No.291649 http://www.linux-counter.org
Registered LFS user No.16792 http://www.linuxfromscratch.org
Uptime: 18:51:41 up 91 days, 11:56, 4 users, load average: 0.03, 0.02, 0.00
Kernel: Linux 2.6.18.6.tex1 GNU/Linux
Processor: model name : Intel(R) Pentium(R) 4 CPU 2.60GHz
web: http://rene-borchers.homelinux.com
------------------------------------------------------
Innocence ends when one is stripped of the delusion that one likes oneself. -- Joan Didion, "On Self Respect"
Dallman Ross | 6 Nov 2007 01:10

RE: Append header in undelivered messages

Xesc Arbona wrote Monday, November 05, 2007 10:42 AM:

> [Dallman Ross wrote:]
> > Try breaking up the recipes into stages so you know just what it
> > is that didn't work.
> > 
> >   :0 fw
> >   * condition
> >   | formail -A "X-Loop: xesca <at> topdesk.com"
> > 
> >   :0 a
> >   *condition
> >   ! forwarding <at> address.dom

> Thank you very much for your help, and sorry for not 
> including my recipes before. The problem was in fact that I 
> was adding the header and sending the message with $SENDMAIL 
> in the same action line. Splitting them in two and adding 
> some fixes solved the issue. The following recipes work now for me:

Glad the fix worked.

> ## Check duplicates
> :0 Wh: $PMCACHE/$RECIPIENT.msgid.lock
> * ! ^X-Loop:.*

You don't need the trailing ".*".  But if others are
also using X-Loop, you will false-poz on this.  Put
in the email address or string you used when creating
your X-Loop before sending out.
(Continue reading)

Dallman Ross | 6 Nov 2007 01:14

RE: decoding non-ascii subject lines

Matthias Haker wrote Saturday, November 03, 2007 11:27 AM:

> i found this on the Web
> 
> http://www.xs4all.nl/~rvtol/procmail/archive/
> 
> and the 101_bq.zip
> 
> contains what you need.
> 
> i use it this way
> 
> :0
> * SUBJECT ?? ()\/.*=\?[a-z0-9-]+\?[bq]\?[^?]+\?=.*
> { 
>  bq_Input=$MATCH
>  bq_Dir="/etc/admin/procmail/inc/"
>  INCLUDERC=/etc/admin/procmail/inc/bq.inc
>  SUBJECT="$bq_Return"
> }

Yes, Ruud wrote some great tools.

You other to set bq_Dir, but then in the very next line you
ignore your only chance to use it.  How about:

   INCLUDERC = $bq_Dir/bq.inc

--

-- 
dman
(Continue reading)

Dallman Ross | 6 Nov 2007 01:16

Re: decoding non-ascii subject lines

On Tue, Nov 06, 2007 at 01:14:07AM +0100, Dallman Ross wrote:
> You other to set bq_Dir, but then in the very next line you

"Bother."  Sorry.  "Bother to set."

--

-- 
dman

Gmane