From: Marius Gavrilescu Date: Mon, 7 Jul 2014 09:23:36 +0000 (+0300) Subject: Send unencrypted replies if encryption fails X-Git-Url: http://git.ieval.ro/?a=commitdiff_plain;h=70f9c37db1acb0579cf25d611468ddbb338c2efa;p=app-edwardng.git Send unencrypted replies if encryption fails --- diff --git a/lib/App/EdwardNG.pm b/lib/App/EdwardNG.pm index 256cf7d..08b50eb 100644 --- a/lib/App/EdwardNG.pm +++ b/lib/App/EdwardNG.pm @@ -129,9 +129,11 @@ sub run { Subject => 'Re: ' . $in->get('Subject'), Data => $data); + my $email_unencrypted = $email->dup; my $mg = mg always_trust => 1; - $mg->mime_signencrypt($email, $in->get('From') =~ /<(.*)>/) and debug 'Could not encrypt message. GnuPG said ', stringify $mg->{last_message}; - sendmail $email + my $encrypt_failed = $mg->mime_signencrypt($email, $in->get('From') =~ /<(.*)>/); + debug 'Could not encrypt message, sending unencrypted. GnuPG said ', stringify $mg->{last_message} if $encrypt_failed; + sendmail $encrypt_failed ? $email_unencrypted : $email } 1;