question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Inline image from attachment

See original GitHub issue

I was wondering if something like this would be possible:

ATTACHMENT: u4qSjQL.jpeg
![](u4qSjQL.jpeg)

I tried it, and it renders to just an image tag: <p><img alt="" src="u4qSjQL.jpeg" /></p></body></html>

Apparently, it is possible via a href that points to the cid.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
captn3m0commented, Apr 27, 2020

The spec says that cids must match the addr-spec, so they must match a valid email address. (Looks like all the SO answers don’t match the spec).

Python 3.2+ comes with a cool email.utils.make_msgid method:

https://github.com/python/cpython/blob/68b352a6982f51e19bf9b9f4ae61b34f5864d131/Lib/email/utils.py#L174-L194

which adds a bit more randomness (and leaks the hostname). But that would still require html parsing to replace hrefs.

Going to pick https://pypi.org/project/html5/, which looks okay-enough for our usecase, and has zero-dependencies.

2reactions
captn3m0commented, Apr 15, 2020

I’m going to take a stab at this, thanks for the pointers.

Will report back if I face issues.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to insert/attach an image inline (in email body) in Outlook?
1. In your composing email, place the cursor where you will insert the image inline, and click Insert > Pictures.
Read more >
How to Embed Images in Your Emails (CID, Inline & More)
1. CID embedded images (inline images) · 2. Inline embedding (Base64 encoding) · 3. Linked images · Don't add attachments. Regardless if it's...
Read more >
How to Insert an Inline Image in a Draft? - Missive
To insert an inline image, you can: Drag and drop the image directly to the draft composer, in the text area. Click the...
Read more >
Inline image to put in real attachment - Microsoft Community
Hi, When I receive an e-mail with an inline image, I want to have the image in "real" attachment (not inline). How can...
Read more >
Embedding Images in HTML Email: Have the Rules Changed?
How to embed images in HTML emails properly? CID attachment, inline embedding, linked image, or any new technique? Read in our overview ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found