We do the sort of signing that is a huge doozy, and Matt is right, it's a
doozy :)  There are a couple of ways we've accomplished re-writing the
body from a MIME::Entity.  Honestly it seems a bit non-standard to me but
we have some special requirements, like leaving the original body around;
I could simplify the examples but I might as well show you known-working
code :P  We currently do:

use File::Temp qw(tempfile);
( $txn->{_body_file}, my $filename ) = tempfile( DIR => $self->temp_dir() );
$txn->body_fh->print("\n");
$mime_entity->print_body( $txn->body_fh );
$txn->{_body_size} = (stat($txn->{_body_file}))[7];
$txn->{_body_start} = 0;

An older method that we used to use (I can't remember whether we switched
to the above because it's more efficient, or because of some of the other
weird things we're doing -- at least the above doesn't require
stringify_body() which is probably slightly undesirable):

$txn->body_resetpos;
$txn->{_body_file}->truncate($txn->{_body_start});
$txn->{_body_size} = $txn->{_body_start};
$txn->body_write( $mime_entity->stringify_body() );

Hope this helps.

-Jared

> On 05/20/2011 04:19 AM, Matt Sergeant wrote:
>> What do you mean by "signed"?
> Signing with a gnugp key.
>
> Actually by signing the original email I get a new MIME::Entity which
> then I need to pass on the queue to get delivered to the real smtp server.
> In other words, the qpsmtpd proxy signs the email and delivers it to the
> real smtp server.
> --
> Thanks for any hint.
> Mike
>
>


Reply via email to