Carstonio has asked for the wisdom of the Perl Monks concerning the following question:

I've modified Benjamin Trott's STAMP script to send HTML form submissions as FDF files, using the PDF::FDF::Simple module. (This after failed attempts to install Adobe's FDF Toolkit.) But I want to send the FDF data as an encrypted attachment.

This MIME::Lite object works fine for sending the unencrypted message:

my $body = $fdf->_fdf_header; foreach (sort keys %{$fdf->content}) { $body .= sprintf ($fdf->_fdf_field_formatstr, $_, $fdf->_quote($fdf->content->{$_})); } $body .=$fdf->_fdf_footer; my $msg = MIME::Lite->new( From =>$cfg->Email, To =>$cfg->To, Subject =>$cfg->Subject, Filename => 'test.fdf', Type =>'application/vnd.fdf', Encoding => 'binary', Data => $body; Disposition => 'attachment' );

Then I tried this:

my $msg = MIME::Lite->new( From =>$cfg->Email, To =>$cfg->To, Subject =>$cfg->Subject, Filename => 'test.pgp', Type =>'application/pgp-encrypted', Encoding => 'binary', Data => $body_encrypted, Disposition => 'attachment' );

This works, except in MS Outlook 2000 I have to save the attachment and type in the ".fdf" suffix. I was hoping to automate the process, so that I could just click on the attachment, enter my PGP password, and open the FDF file automatically. Any suggestions would be great.

Replies are listed 'Best First'.
Re: Can MIME::Lite send PGP-encrypted attachments?
by clscott (Friar) on Aug 10, 2004 at 20:41 UTC
    You need to provide the filename as part of the headers. I believe that you can do that in the Content-Disposition MIME header.
    Disposition => 'attachment; filename=file.fdf'
    --
    Clayton
      Thanks. I tried using MIME::Lite's as_string method, and it already had the filename information in the e-mail header. So I'm still trying to find a solution.

        In your second example you are sending the filename as 'test.pgp' vs 'test.fdf' are you not?

        --
        Clayton