if defined $tmplData->{$extra};
}
- # Possibly GPG Encrypt the message.
- if ($tmplData->{'encrypt'}) {
- my $ret = $mg->mime_encrypt($mail, @emails);
+ # Possibly GPG Encrypt and Sign the message.
+ if ($tmplData->{'encrypt'} && $tmplData->{'sign'}) {
+ my $ret = $mg->mime_signencrypt($mail, @emails);
if ($ret != 0) {
warn "Sorry, gpg encrypt error: " . join(", ", @{ $mg->{last_message} }) . "\n";
push @gpg_failed_addresses, @emails;
next;
}
- }
# Possibly GPG Sign the message.
- if ($tmplData->{'sign'}) {
+ } elsif ($tmplData->{'sign'}) {
my $ret = $mg->mime_sign($mail, $tmplData->{'from'});
if ($ret != 0) {
die "Sorry, gpg sign error: " . join(", ", @{ $mg->{last_message} }) . "\n";
}
+
+ # Possibly GPG Encrypt the message.
+ } elsif ($tmplData->{'encrypt'}) {
+ my $ret = $mg->mime_encrypt($mail, @emails);
+
+ if ($ret != 0) {
+ warn "Sorry, gpg encrypt error: " . join(", ", @{ $mg->{last_message} }) . "\n";
+ push @gpg_failed_addresses, @emails;
+ next;
+ }
}
$mail->send('sendmail');