Inline image from attachment
See original GitHub issueI 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:
- Created 3 years ago
- Reactions:1
- Comments:8 (8 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
I’m going to take a stab at this, thanks for the pointers.
Will report back if I face issues.