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

Header param encoding #310

Open
juhlig opened this issue Feb 15, 2022 · 3 comments
Open

Header param encoding #310

juhlig opened this issue Feb 15, 2022 · 3 comments

Comments

@juhlig
Copy link
Contributor

juhlig commented Feb 15, 2022

gen_smtp/src/mimemail.erl

Lines 924 to 929 in c6f25a7

encode_parameter({X, Y}) ->
YEnc = rfc2047_utf8_encode(Y, byte_size(X) + 3, <<"\t">>),
case escape_tspecial(YEnc, false, <<>>) of
{true, Special} -> [X, $=, $", Special, $"];
false -> [X, $=, YEnc]
end.

I think this is wrong (though most Mail clients seem to accept it): Parameters should be encoded according to RFC 2231, not RFC 2047.

@seriyps
Copy link
Collaborator

seriyps commented Feb 15, 2022

Oh, interesting. This change have been merged quite recently #235. But I think it would worth to add support for RFC-2231 (in parser as well; including multiline params)

@Maria-12648430
Copy link
Contributor

#311 is about the encoding of parameter values. I'll see what I can do about decoding in a later PR (probably quite tricky, it looks like many clients do it wrong, so we need to be able to parse both RFC2231 and RFC2047), but I think first this PR should be carefully reviewed.

@Maria-12648430
Copy link
Contributor

I noticed some bugs in header parameter parsing that I need to iron out before tackling the actual decoding 😞

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

3 participants