-
Notifications
You must be signed in to change notification settings - Fork 581
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
Encoded headers violate RFC 2047 #53
Comments
Did you run into an issue sending this email? Because even popular service like Gmail don't always respect these kind of rules. Anyway, for now you can use Go 1.6 where encoded-words are automatically split which will reduce the line length. And I will soon fix that issue in Gomail. |
The only issue I've seen is sending an email which is parsed on the receiving end by Python's |
This should be better. Please tell me if it works now. |
I just got around to testing this. I've noticed two problems:
Here's my code:
And here's the output:
|
Also, I'd like to suggest two different functions (or options) for setting a header: the first would be a way to set a header that would not be modified in any way and the second would be a way to set a header that would be automatically encoded and folded as necessary. |
As I said earlier you need Go 1.6 to have the headers split. The headers will still be a bit too long but I sent a fix that should be in Go 1.7: https://go-review.googlesource.com/#/c/20918/ Concerning the newline at the start of the header, it doesn't seem forbidden by the RFCs but it might cause bugs in some client. Did you notice issues because of it? |
Not yet, but as I'm using this library to send email to all sorts of recipients with all sorts of different MUAs, I can't state with confidence that it would or would not cause an issue. |
I tested with Go 1.6. Regarding the newline, I found an issue reading one of these headers using Python's
When this message is read in Python, an extra space is included before the start of the real header value:
The extra space breaks later processing of the header. |
It is closer to Gmail behavior for example. See #53
I updated the code not to insert a newline as the first character. The drawback is that a header line can now be longer than 76 characters. I won't do more for two reasons:
The first encoded-word is 84 characters-long and the first line is 93 characters-long. Yet I suppose Gmail has a pretty good deliverability rate 😄 So I am sorry but I think it is the Python library you are using that should be fixed. I cannot do reasonably much more. |
Here's a small Golang program which demonstrates the problem:
This program will output these headers:
Note that the
Subject
header line is 96 characters long. According to RFC 2047,The
Subject
header should have been folded at 76 characters but it was not.The text was updated successfully, but these errors were encountered: