mirror of
https://github.com/simple-login/app.git
synced 2025-02-25 00:03:03 +08:00
handle multipart/mixed in add_header
This commit is contained in:
parent
0cf283089d
commit
ef2624ccea
1 changed files with 14 additions and 0 deletions
|
@ -796,6 +796,20 @@ def add_header(msg: Message, text_header, html_header) -> Message:
|
||||||
clone_msg.set_payload(new_parts)
|
clone_msg.set_payload(new_parts)
|
||||||
return clone_msg
|
return clone_msg
|
||||||
|
|
||||||
|
elif msg.get_content_type() == "multipart/mixed":
|
||||||
|
new_parts = []
|
||||||
|
parts = list(msg.get_payload())
|
||||||
|
LOG.d("only add header for the first part")
|
||||||
|
for ix, part in enumerate(parts):
|
||||||
|
if ix == 0:
|
||||||
|
new_parts.append(add_header(part, text_header, html_header))
|
||||||
|
else:
|
||||||
|
new_parts.append(part)
|
||||||
|
|
||||||
|
clone_msg = copy(msg)
|
||||||
|
clone_msg.set_payload(new_parts)
|
||||||
|
return clone_msg
|
||||||
|
|
||||||
LOG.d("No header added for %s", msg.get_content_type())
|
LOG.d("No header added for %s", msg.get_content_type())
|
||||||
return msg
|
return msg
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue