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

mime-id/get-random should not put ID in angle brackets #14

Open
mkreis opened this issue Apr 12, 2022 · 1 comment
Open

mime-id/get-random should not put ID in angle brackets #14

mkreis opened this issue Apr 12, 2022 · 1 comment

Comments

@mkreis
Copy link
Contributor

mkreis commented Apr 12, 2022

The inline image example from the README
(let [content-id (mime-id/get-random)] (tarayo/send! conn { ... {:content (io/file "test/resources/image.png") :id content-id}]})))

does not work:

(mime-id/get-random) generates an ID with angle brackets (e.g. <[email protected]>),
but when generating the message, the content ID is again put into angle brackets here:
https://github.com/toyokumo/tarayo/blame/master/src/tarayo/mail/mime/multipart/body.clj#L88=

This results in the following invalid HTML img tag and the img not being displayed (at least in Thunderbird):

`------=_Part_2_1478985609.1649756558122
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit

world
------=_Part_2_1478985609.1649756558122
Content-Type: image/png
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename=logo.png
Content-ID: <[email protected]>`

Also the content id now contains double angle brackets.

To fix this issue, either the ID should not be out into angle brackets or the Content-ID is inserted without putting it into angle brackets. I would prefer the first option to keep backwards compatibilty and also not to have the implicit assumption, that all supplied content ids will be put into angle brackets.

@liquidz
Copy link
Member

liquidz commented Jun 28, 2022

@mkreis I'm so sorry for late reply.

tarayo.mail.mime.id/get-random is a function for the Message-ID header, so the example used for Content-ID was wrong to begin with.
Thus I can not merge #15 because changes in the PR could affect Message-ID.

Is it enought to use random-uuid? How do you think?
e.g. (let [content-id (str (random-uuid))] ...)

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

No branches or pull requests

2 participants