Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix embedded image cid for named senders with a 'from' address like 'Sender <noreply@sender.com>' #33

Merged
merged 1 commit into from Feb 28, 2022

Conversation

StefanVietze
Copy link

I was struggeling with embedding an image in an html mail body. The picture was attached however it didn't show up in Outlook.

The issue was caused by the sender address which was something like 'AnyFancyName email@address.com'. To be precise the issue is caused by the '>' at the end of the string which survives with your current split logic and causes the cid to have two '>' characters at the end.

I would suggest to use parseaddr function from email.utils to get the raw email address from the msg['from'] field.

@Miksus
Copy link
Owner

Miksus commented Feb 26, 2022

Thanks for pointing this out and making a fix! This indeed seems sensible. I'll try tomorrow to test this myself as well so I get gasp on how the issue actually looks like (and possibly make a test case for this), and then I'll merge this PR.

@codecov-commenter
Copy link

Codecov Report

Merging #33 (0449b6d) into master (87c255e) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #33   +/-   ##
=======================================
  Coverage   99.48%   99.48%           
=======================================
  Files          13       13           
  Lines         584      584           
=======================================
  Hits          581      581           
  Misses          3        3           
Impacted Files Coverage Δ
redmail/email/body.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 87c255e...0449b6d. Read the comment docs.

@Miksus
Copy link
Owner

Miksus commented Feb 28, 2022

Yep, I now realized what you meant the issue was. Interestingly, it seems Gmail is able to display the image correctly but Outlook does not even though the embedding of CID is indeed wrong. Thanks again for the fix.

I'll try to release a patch about this in the current week.

@Miksus Miksus merged commit 1d8cc62 into Miksus:master Feb 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants