[Mimedefang] MIME::Entity->attach encoding of an already encoded body/bodyhandle
Rolf E. Sonneveld
R.E.Sonneveld at sonnection.nl
Thu Aug 4 12:37:02 EDT 2011
On 8/4/11 5:23 PM, David F. Skoll wrote:
> On Thu, 04 Aug 2011 16:20:48 +0200
> "Rolf E. Sonneveld"<R.E.Sonneveld at sonnection.nl> wrote:
>
>> $newmsg->attach(Data => $bodypart,
>> Encoding => "base64");
> Don't use attach. Use add_part instead (see the MIME::Entity man page)
> You'll need to ensure that $newmsg is a multipart entity which you can
> force with the make_multipart method.
When I use add_part I end up with the base64 encoded bodyhandle, see below.
During 'filter':
$bodypart = $entity->bodyhandle;
During 'filter_end':
(first bodypart is some html stuff)
$newmsg = MIME::Entity->build(
Data => $htmlpart,
Type => "text/html",
Encoding => "-SUGGEST",
Disposition => "inline");
$newmsg->make_multipart;
action_add_part($newmsg,$bpType,$bpEncoding,$bodypart,$bpFilename,"attachment");
The contents of the resulting added bodypart looks like:
TUlNRTo6Qm9keTo6RmlsZT1IQVNIKDB4Nzk5ZDAwKQ==
which decodes to:
MIME::Body::File=HASH(0x799d00)
Any hints?
/rolf
More information about the MIMEDefang
mailing list