Replace a header. Replace the first matching header found in the message, retaining header order and case. If no matching header was found, a KeyError is raised.
email.message/EmailMessage.replace_header
EmailMessage.replace_header