Skip to content

Lack of CRLF line endings in text/plain prior to base64 encoding #4

@horgh

Description

@horgh

RFC 2049 section 4 step 2 says we should transform bodies to CRLF line endings ("canonical form"). I've found that emails built using Courriel::Builder's build_email() with plain_body() do not have such line endings when passing a body with LF line endings. The base64 body does, but not the raw body that gets base64 encoded.

For example, if we give Courriel plain_body("hi\nthere") we get something like encode_base64("hi\nthere", "\r\n") where I think we should have encode_base64("hi\r\nthere", "\r\n").

Presumably this is usually okay. However, I've had a recent issue where a more esoteric MUA was not displaying a plaintext email built this way correctly, and this is one possible, though unlikely, culprit. Unfortunately I've not been able to verify whether this is the cause.

I'm not entirely sure this should be Courriel's responsibility, though I think it might make sense. If not, it could be something to document at least so that callers know to do it.

What do you think?

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions