[Mimedefang] Content-type mystery
Rolf E. Sonneveld
R.E.Sonneveld at sonnection.nl
Tue Aug 16 08:28:46 EDT 2011
Hi,
running MIMEDefang 2.71.
I'm running into the following problem. I have a mimedefang-filter
script, which tries to determine the message's (top or outer) header
content-type to decide what to do with the message:
sub filter_begin {
my($entity, $name, $ext, $type) = @_;
$head = $entity->head;
$toptype = $head->get('Content-type');
Now this run's fine when I send 'multipart' messages through the filter
(i.e. messages with a content type multipart/... in the header). The
content-type is determined correctly and can be used to decide what to
do next.
However, as soon as I send a text/plain message through the filter, the
content-type that is 'seen' by the mimedefang-filter is not
'text/plain', but it is 'multipart/mixed'. Then, when this same message
is received (unalterated) by the recipient, the content-type is just
'plain/text' as it originally was (not 'multipart/mixed').
Analysing this problem, I decide to dump the complete header of the
message to a log file. This showed me that the original content-type was
not present in the $head object, instead the $head object had a
content-type line at the end of the header.
Input header (injected with telnet via port 25):
From: someone at somewhere.org
To: test at test.com
Subject: test content type
Content-type: text/plain
Date: 16 Aug 2011 12:15:00 +0200
The header as dumped (using $head->as_string) shows this header as:
From: someone at somewhere.org
To: test at test.com
Subject: test content type
Date: 16 Aug 2011 12:15:00 +0200
Message-Id: <20110816110104.2122A5B940 at somewhere.org>
Content-type: multipart/mixed; boundary="----------=_1313492497-15062-0"
Please note the difference in content-type.
Mimedefang is called from within Postfix, where Postfix inserted the
Message-ID. I have looked througout the Postfix configuration, but I
can't find anywhere a place in the Postfix configuration which could be
responsible for the fact that MIMEdefang sees a content-type
multipart/mixed instead of text/plain. Besides that, the recipient
system shows a text/plain content-type as well.
On the receiving side, the message header shows this:
MIME-version: 1.0
Content-transfer-encoding: 7BIT
Content-type: text/plain
From: someone at somewhere.org
To: test at test.com
Subject: test content type
Date: Tue, 16 Aug 2011 12:15:00 +0200
Message-id: <20110816110104.2122A5B940 at somewhere.org>
X-Scanned-By: MIMEDefang 2.71 on 10.60.1.180
BTW: determining the effective content type:
$effecttype = $entity->effective_type;
shows exactly the same as the $toptype (i.e. multipart/mixed instead of
text/plain).
Where does MIMEDefang (or MIME::Entity) gets this content-type
multipart/mixed from? And how can I solve this problem? Is there any
chance on stale data after a run of MIMEdefang?
Any help appreciated.
/rolf
More information about the MIMEDefang
mailing list