Hi,

during the 'filter' phase I store a reference to one of the bodyparts of the incoming message (this bodypart is base64 encoded at this stage), using:

$bodypart = $entity->body

Next, I try to use this bodypart during the 'filter_end' phase to create a new MIME entity ($newmsg). I try to attach this bodypart using:

$newmsg->attach(Data => $bodypart,
   Encoding => "base64");

or

$newmsg->attach(Data => $bodypart,
   Encoding => "-SUGGEST");

the result is that MIMEDefang (or MIME::Entity) encodes the already encoded base64 blob again using base64, which effectively creates a bodypart that cannot be used by the recipient.

When I use

$newmsg->attach(Data => $bodypart,
   Encoding => "7bit");

the MIME encoded bodypart is not encoded again, however, this leaves me with the wrong bodypart Content-transfer-encoding label (7bit). When fetching the $bodypart using $entity->bodyhandle (which seems exactly what I need), I get the following error in syslog when submitting a message:

Slave 1 stderr: I can't handle DATA which is a MIME::Body::File

I may be able, probably, to work around this by first dumping the (decoded) contents to a tmpfile, then attach it using base64 (which encodes the bodypart again) but that's not very efficient.

What is the recommended approach here?

/rolf
_______________________________________________
NOTE: If there is a disclaimer or other legal boilerplate in the above
message, it is NULL AND VOID.  You may ignore it.

Visit http://www.mimedefang.org and http://www.roaringpenguin.com
MIMEDefang mailing list [email protected]
http://lists.roaringpenguin.com/mailman/listinfo/mimedefang

Reply via email to