CC: | Robert Spier <rspier [...] cpan.org> |
Subject: | Mail::GnuPG->mime_signencrypt |
Date: | Fri, 25 Aug 2006 06:21:50 +1000 |
To: | bug-Mail-GnuPG [...] rt.cpan.org |
From: | Philip Cook <health [...] limasila.com> |
Message body not shown because it is not plain text.
Dear Mail::GnuPG maintainers
Can anyone suggest how to both sign and encrypt email from perl. It
seems that ->mime_sign($entity) and ->mime_encrypt($entity, @recipients)
work when I test it with evolution but for ->mime_signencrypt($entity,
@recipients) evolution just reports that the email is encrypted but not
signed and encrypted.
The code that I am using (with some minor modifications) is;
#! /usr/bin/perl
use strict;
use warnings;
use MIME::Entity;
use Mail::GnuPG;
my $html = <<END_HTML;
<p><strong>HTML mail demo</strong>
<p>This is the message text
<p>It will only be displayed correctly by HTML-capable Mail clients
since it has no "text/plain" alternative part.
END_HTML
my $top = MIME::Entity->build(
"To" => "to\@mydomain.com",
"From" => "from\@mydomain.com",
"Subject" => "Test notify HTML mail",
"Type" => "multipart/mixed"
);
$top->attach(
"Type" => "text/html",
"Encoding" => "UTF-8",
"Data" => [ $html ]
);
my $mg = Mail::GnuPG->new(
"keyid" => "99999999",
"passphrase" => "secret",
"keydir" => "/home/philip/.gnupg"
);
my $ret = $mg->mime_signencrypt ($top , "to\@mydomain.com" );
print "ret = $ret\n";
if (!$ret) {
$top->smtpsend(
"Confirm" => "delivery, reading",
"Host" => "mail.mydomain.com.au"
);
$top->print(\*STDOUT);
}
Thanks in advance for your attention and reply to my email
Regards
Philip
Preston, Australia