Discussion:
[maildropl] Body flag doesn't look into attachments in 2.7
Davide Davini
2014-06-23 07:48:54 UTC
Permalink
On: FreeBSD gino.bramieri.com 8.4-RELEASE-p12 FreeBSD 8.4-RELEASE-p12
#14: Thu Jun 19 15:45:31 CEST 2014

Mail drop port version: maildrop-2.7.1_1

Since [yesterday] I upgraded to 2.7[1] my scripts that use :b flag don't
seem to look into the attachment anymore. Curses.

Example:
if (/pippo/:b && /^To:.****@bramieri.com/)
{
<do stuff>
}

It works fine when "pippo" is in the, let's say, main body of the email
but it fails miserably when "pippo" is in the attachment part of the
body. It was working like a charm until the upgrade.

Did something that I do not know of change? Is it a bug? Workarounds?

Any advice is welcome.

Ciao,
Daivde

[1] from 2.6, if I recall correctly.
Sam Varshavchik
2014-06-23 10:12:15 UTC
Permalink
Post by Davide Davini
On: FreeBSD gino.bramieri.com 8.4-RELEASE-p12 FreeBSD 8.4-RELEASE-p12
#14: Thu Jun 19 15:45:31 CEST 2014
Mail drop port version: maildrop-2.7.1_1
Since [yesterday] I upgraded to 2.7[1] my scripts that use :b flag don't
seem to look into the attachment anymore. Curses.
{
<do stuff>
}
It works fine when "pippo" is in the, let's say, main body of the email
but it fails miserably when "pippo" is in the attachment part of the
body. It was working like a charm until the upgrade.
Did something that I do not know of change? Is it a bug? Workarounds?
:b should look in attachments if they are text attachments. It will no
longer look inside binary attachments.

Starting with 2.7.0, maildrop's text search is fully UTF-8-compliant. The
search strings must be specified in the UTF-8 codeset; and maildrop will, if
necessary, transcode each MIME section into UTF-8 text, for searching.

This means that non-textual binary attachments are no longer searched; only
text attachments get searched.
Davide Davini
2014-06-23 10:40:46 UTC
Permalink
Post by Sam Varshavchik
:b should look in attachments if they are text attachments. It
will no longer look inside binary attachments.
We are talking about text attachments, I'm processing delivery failure
notifications. If I find the IP address of my client server I forward
the undeliverable DFN to them.
Post by Sam Varshavchik
Starting with 2.7.0, maildrop's text search is fully
UTF-8-compliant. The search strings must be specified in the UTF-8
codeset; and maildrop will, if necessary, transcode each MIME
section into UTF-8 text, for searching.
I mean, it works if the same text is in the "main body" so I would be
surprised if that is the problem, but I don't know really.
Post by Sam Varshavchik
This means that non-textual binary attachments are no longer
searched; only text attachments get searched.
This is an example of the emails I'm talking about where
999.999.999.999 is the IP address I'm looking for:

Return-Path: <MAILER-DAEMON>
Received: from pino.bramieri.com (pino.bramieri.com [***.***.***.***])
by gino.bramieri.com (8.14.7/8.14.7) with ESMTP id s5N8pGTI018808
(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL)
for <***@bramieri.com>; Mon, 23 Jun 2014 10:51:16 +0200 (CEST)
Received: from localhost (localhost)
by pino.bramieri.com (8.14.7/8.14.7) id s5N8pG3Y095815;
Mon, 23 Jun 2014 10:51:16 +0200 (CEST)
(envelope-from MAILER-DAEMON)
Date: Mon, 23 Jun 2014 10:51:16 +0200 (CEST)
From: Mail Delivery Subsystem <MAILER-***@pino.bramieri.com>
Message-Id: <***@pino.bramieri.com>
To: ***@pino.bramieri.com
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
boundary="s5N8pG3Y095815.1403513476/pino.bramieri.com"
Subject: Postmaster notify: see transcript for details
Auto-Submitted: auto-generated (postmaster-notification)

This is a MIME-encapsulated message

- --s5N8pG3Y095815.1403513476/pino.bramieri.com

The original message was received at Mon, 23 Jun 2014 10:51:16 +0200
(CEST)
from localhost
with id s5N8pG3X095815

----- The following addresses had permanent fatal errors -----
<***@dodododo.it>
(reason: 550 #5.1.1 Rejected User unknown.)

----- Transcript of session follows -----
Post by Sam Varshavchik
DATA
<<< 503 #5.5.1 RCPT first

- --s5N8pG3Y095815.1403513476/pino.bramieri.com
Content-Type: message/delivery-status

Reporting-MTA: dns; pino.bramieri.com
Received-From-MTA: DNS; [999.999.999.999]
Arrival-Date: Mon, 23 Jun 2014 10:51:16 +0200 (CEST)

Final-Recipient: RFC822; ***@dodododo.it
Action: failed
Status: 5.1.1
Remote-MTA: DNS; ***.***.***.***.com
Diagnostic-Code: SMTP; 550 #5.1.0 Rejected by bounce verification.
Last-Attempt-Date: Mon, 23 Jun 2014 10:51:16 +0200 (CEST)

- --s5N8pG3Y095815.1403513476/pino.bramieri.com
Content-Type: text/rfc822-headers

Return-Path: <MAILER-DAEMON>
Received: from localhost (localhost)
by pino.bramieri.com (8.14.7/8.14.7) id s5N8pG3X095815;
Mon, 23 Jun 2014 10:51:16 +0200 (CEST)
(envelope-from MAILER-DAEMON)
Date: Mon, 23 Jun 2014 10:51:16 +0200 (CEST)
From: Mail Delivery Subsystem <MAILER-DAEMON>
Message-Id: <***@pino.bramieri.com>
To: <***@dodododo.it>
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
boundary="s5N8pG3X095815.1403513476/pino.bramieri.com"
Subject: Returned mail: see transcript for details
Auto-Submitted: auto-generated (failure)

- --s5N8pG3Y095815.1403513476/pino.bramieri.com--
Sam Varshavchik
2014-06-23 11:47:39 UTC
Permalink
Post by Davide Davini
Post by Sam Varshavchik
This means that non-textual binary attachments are no longer
searched; only text attachments get searched.
This is an example of the emails I'm talking about where
I see. What you're looking for has

Content-Type: message/<subtype>

and maildrop is looking only inside MIME text content type. This will need
to be changed; I don't see a problem with doing a text search inside the
"message" MIME content type.
Davide Davini
2014-06-23 12:31:50 UTC
Permalink
Post by Sam Varshavchik
Post by Davide Davini
Post by Sam Varshavchik
This means that non-textual binary attachments are no longer
searched; only text attachments get searched.
This is an example of the emails I'm talking about where
I see. What you're looking for has
Content-Type: message/<subtype>
and maildrop is looking only inside MIME text content type. This
will need to be changed; I don't see a problem with doing a text
search inside the "message" MIME content type.
If I'm understanding it correctly you are saying that maildrop finds
"Content-Type: message/delivery-status" and not the content type it
aspects to find [Content-Type: text/plain or whatever] and that is why
it doesn't get parsed.

That's a bummer because those messages are generated automatically by
the MTA and I can't change them. As far as I know anyway.
Sam Varshavchik
2014-06-23 12:40:35 UTC
Permalink
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Post by Sam Varshavchik
Post by Davide Davini
Post by Sam Varshavchik
This means that non-textual binary attachments are no longer
searched; only text attachments get searched.
This is an example of the emails I'm talking about where
I see. What you're looking for has
Content-Type: message/<subtype>
and maildrop is looking only inside MIME text content type. This
will need to be changed; I don't see a problem with doing a text
search inside the "message" MIME content type.
If I'm understanding it correctly you are saying that maildrop finds
"Content-Type: message/delivery-status" and not the content type it
aspects to find [Content-Type: text/plain or whatever] and that is why
it doesn't get parsed.
That's a bummer because those messages are generated automatically by
the MTA and I can't change them. As far as I know anyway.
Correct. maildrop will need to be changed, so that it can search inside the
message/delivery-status MIME content.

As a workaround in the meantime, you can have maildrop use fgrep:

FOUND=`fgrep -q 999.999.999.999; echo \$?`

Something like that. Might need experimenting, to get the syntax right.
Davide Davini
2014-06-23 14:30:33 UTC
Permalink
Post by Sam Varshavchik
FOUND=`fgrep -q 999.999.999.999; echo \$?`
Something like that. Might need experimenting, to get the syntax right.
Yep, I did this:
FOUND=`fgrep -m1 999.999.999.999`
if ($FOUND == /999.999.999.999/ && /^To:.****@r.com/)
{
<do stuff>
}

So far so good. Thanks a bunch!

Ciao,
Davide
Davide Davini
2014-11-14 16:07:09 UTC
Permalink
Yep, I did this: FOUND=`fgrep -m1 999.999.999.999` if ($FOUND ==
I was checking old emails when I noticed this post of mine.

It works much better like this.

if (/^To:.****@r.com/)
{
FOUND=`fgrep -m1 -o 999.999.999.999`
if ( $FOUND == 999.999.999.999)
{
<do stuff>
}
}

Bye,
Davide

Loading...