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 lines can be too long #36

Closed
Synchro opened this issue Apr 4, 2013 · 3 comments
Closed

Header lines can be too long #36

Synchro opened this issue Apr 4, 2013 · 3 comments
Labels

Comments

@Synchro
Copy link
Member

Synchro commented Apr 4, 2013

The EncodeHeader function has two problems:

  1. If a header needs Q or B encoding, it also gets folding applied, but if a line has no characters that need encoding, but is still too long, it will not get folded.
  2. When a header does get folded, it only takes into account the length of the value, not the key, and the combination of the two can make the line too long.

This makes me think that the folding is applied at the wrong point. Header values should be encoded and returned, and folded later after combining with their keys. That said, I don't know if Q and B encoded headers really need their prefixes applied on every line, which is what they are doing at present.

Update: Q and B encodings do need their prefixes repeating on each line because an RFC 2047 'encoded-word' may not contain white space, and thus cannot be folded.

@chocolata
Copy link

Hi, is there any update on this issue? Using PHPMailer in combination with Sendgrid via (SMTPAPI) and am encountering lots of issues, as the recipients are stored in a custom header. After 72 characters, newlines are inserted, which results in broken e-mail addresses...

@Synchro
Copy link
Member Author

Synchro commented May 19, 2016

Line breaks in headers are not a problem because they are folded, but that's not what this issue is about - it's about headers being allowed to get too long before they are folded.

Can you open a new ticket and be more specific about your problem, provide examples etc?

@chocolata
Copy link

Thanks so much for your follow-up. I've posted my issue here: #726

It's a long one. Sorry in advance :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants