Skip to content

Commit

Permalink
Merge pull request #33 from StefanVietze/master
Browse files Browse the repository at this point in the history
Fix embedded image cid for named senders with a 'from' address like 'Sender <noreply@sender.com>'
  • Loading branch information
Miksus committed Feb 28, 2022
2 parents 87c255e + 0449b6d commit 1d8cc62
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions redmail/email/body.py
Expand Up @@ -9,7 +9,7 @@
from redmail.utils import is_bytes
from redmail.utils import import_from_string

from email.utils import make_msgid
from email.utils import make_msgid, parseaddr

from jinja2.environment import Template, Environment

Expand Down Expand Up @@ -109,7 +109,7 @@ def attach(self,
jinja_params : dict
Extra Jinja parameters for the HTML.
"""
domain = msg["from"].split("@")[-1] if self.domain is None else self.domain
domain = parseaddr(msg["from"])[1].split("@")[-1] if self.domain is None else self.domain
html, cids = self.render(
html,
images=images,
Expand Down Expand Up @@ -244,4 +244,4 @@ def attach_imgs(self, msg_body:EmailMessage, imgs:Dict[str, Union[ByteString, st
img_content,
cid=cid,
**kwds
)
)

0 comments on commit 1d8cc62

Please sign in to comment.