Browse Source

encrypt sent email if contact has PGP enabled

Son NK 5 years ago
parent
commit
b962d6a2c1
1 changed files with 5 additions and 0 deletions
  1. 5 0
      email_handler.py

+ 5 - 0
email_handler.py

@@ -605,6 +605,11 @@ def handle_reply(envelope, smtp: SMTP, msg: Message, rcpt_to: str) -> (bool, str
         if custom_domain.dkim_verified:
         if custom_domain.dkim_verified:
             add_dkim_signature(msg, alias_domain)
             add_dkim_signature(msg, alias_domain)
 
 
+    # create PGP email if needed
+    if contact.pgp_finger_print and user.is_premium():
+        LOG.d("Encrypt message for contact %s", contact)
+        msg = prepare_pgp_message(msg, contact.pgp_finger_print)
+
     smtp.sendmail(
     smtp.sendmail(
         alias.email,
         alias.email,
         contact.website_email,
         contact.website_email,