Browse Source

fix replace_header

Son NK 5 năm trước cách đây
mục cha
commit
e335ae7d52
1 tập tin đã thay đổi với 5 bổ sung1 xóa
  1. 5 1
      email_handler.py

+ 5 - 1
email_handler.py

@@ -114,7 +114,11 @@ class MailHandler:
 
 
                 # add custom header
                 # add custom header
                 msg.add_header("X-SimpleLogin-Type", "Forward")
                 msg.add_header("X-SimpleLogin-Type", "Forward")
-                msg.replace_header("Reply-To", forward_email.reply_email)
+                try:
+                    msg.add_header("Reply-To", forward_email.reply_email)
+                except ValueError:
+                    # the header exists already
+                    msg.replace_header("Reply-To", forward_email.reply_email)
 
 
                 LOG.d(
                 LOG.d(
                     "Send mail from %s to %s, mail_options %s, rcpt_options %s ",
                     "Send mail from %s to %s, mail_options %s, rcpt_options %s ",