X-Git-Url: http://git.ieval.ro/?a=blobdiff_plain;f=lib%2FApp%2FEdwardNG.pm;h=08b50eb827865e4b1e155cf2cee6f414dd605703;hb=70f9c37db1acb0579cf25d611468ddbb338c2efa;hp=88046414814dfe4af44f5cbe016a4bbf50be60f7;hpb=1f08c3525c33b88f5b67e84b573f695ec2d4643e;p=app-edwardng.git diff --git a/lib/App/EdwardNG.pm b/lib/App/EdwardNG.pm index 8804641..08b50eb 100644 --- a/lib/App/EdwardNG.pm +++ b/lib/App/EdwardNG.pm @@ -121,18 +121,19 @@ sub run { $params{plaintext} = first_part $params{decrypted} if $params{decrypted}; my $tt = Template->new(INCLUDE_PATH => 'tmpl/en'); - my ($data, $subject); + my $data; $tt->process($tmpl, \%params, \$data); - $tt->process('subject', undef, \$subject); my $email = MIME::Entity->build( From => $ENV{EDWARDNG_FROM}, To => $in->get('From'), - Subject => $subject, + 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;