-
Notifications
You must be signed in to change notification settings - Fork 30
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
Email address quotes are not preserved when phrase is not defined #52
Comments
Apparently this is more complicated problem. Function Due to how MIME is working, for structures headers like addresses, it is first needed to fully decompose address-like header into internal structures, then every Unicode string needs to be encoded into 8bit MIME and after that header value is composed back to one structured string. And it is better to guarantee RFC-compliant output which represent same input, rather then trying to hack around some special cases to not touch header, like in your case. Your current bug report is just about different representation of encoded MIME header and both values have same meaning. There are plenty equivalent representation of your example (Unicode) input in MIME. |
So question is, why you want to hack |
Anyway, |
Very good question, in the existing code I maintain, And Yes I agree this is not a bug, but a behavior change. Our main concern with this change is that this could affect the spam score from Mail::SpamAssassin, as an email without "" has a malus. For your second message (hoped that github could handle reply to each message individually) I agree |
Email::Simple::Header is probably the one providing all the abstraction to manipulate headers, but do not provide the encoding layer |
Ah :-( Email::MIME::Encode is a private helper for MIME header encoding which is written in documentation https://metacpan.org/pod/Email::MIME::Encode but seems that it does not stop people to use it and then start seeing different behavior of private functions... Anyway, you are not alone some people are not stopped even when function starts with underline, which is perl way for private function rjbs/Email-MIME-ContentType#6 So I would suggest you to stop using private functions of random modules as they can be changed at anytime. If you have really good reason for it, try to ask if such function cannot be marked as public, define stable API and important: write documentation for it.
What does it mean without |
…t explicit "use Email::MIME::Header" Email::MIME::Encode uses %Email::MIME::Header::header_to_class_map variable but have not loaded Email::MIME::Header module. This patch fixes it. Problem discovered by atoomic in report rjbs#52.
Fix for Email::MIME::Encode to work also without explicit Email::MIME::Header loading is there: #54 |
Another idea would be patching Email::Address::XS (and also probably the non XS one) to add a boolean in the message_address struct [then use it] to know if angle brackets were used in the original version then preserve it if it were used ? We could either make the default behavior to preserve the angle brackets or make it optional, so Email::MIME could set it or not depending on the option. Problem is this would require patching the upstream dovecot code diff --git a/Email-Address-XS/dovecot-parser.h b/Email-Address-XS/dovecot-parser.h
index b0263543d..d03a7ba1d 100644
--- a/Email-Address-XS/dovecot-parser.h
+++ b/Email-Address-XS/dovecot-parser.h
@@ -19,6 +19,7 @@ struct message_address {
char *comment;
/* there were errors when parsing this address */
bool invalid_syntax;
+ bool use_anglebrackets;
};
|
I'm not very happy for making this module public for another modules. What is your purpose? Or better question, why is not Email::MIME enough for you? Is there a bug or missing feature in Email::MIME?
Email::Address is dead and contains security issues. Rather do not use it on untrusted input. I have example of emails which cause DOS on servers which uses Email::Address->parse(). Reason why I created Email::Address::XS.
I do not like this idea. Two reasons:
See example:
There are a couple of ways how to write into header address with user='a.b', host='host.com', phrase='Name' and with comment after address '(last comment)'. Format function choose one which is not so complicated, valid according to RFC2822 and is not hard to parse. In new version of Email::Address::XS there would be method Maybe now for you it looks like it could be used in Email::MIME. But, this would not work if you modify some member of Email::Address::XS -- e.g. any MIME encoding/decoding. Look at example: So my suggestion is: If you need to preformat some email header, then use method |
First thanks for your long & precise answer, and sorry for my late answer on this topic. There are multiple reasons we are not using the full version of Email::MIME:
here are some basic metrics [this is mainly working on linux system - not stable on macosx]
I trend to share your point of view where we should not use a private method in our codebase, and either use the whole enchilada or not... [ I've just opened an internal case for this ]. I also agree that both syntax are corrects. The root problem we were trying to solve here was to preserve the We were trying to add a rule saying: if the original email was using From my point of view, we can close this ticket, I was mainly pointing to a behavior change. The commit in #54 would at least make it behave consistent. |
Anyway, have you reported bug to SpamAssassin that prediction of spam based on missing |
…t explicit "use Email::MIME::Header" Email::MIME::Encode uses %Email::MIME::Header::header_to_class_map variable but have not loaded Email::MIME::Header module. This patch fixes it. Problem discovered by atoomic in report #52.
Notice after updating Email::MIME from 1.940 to version 1.945
The email address '<>' quotes are not preserved if no phrase/name is set
one liner to show the issue with 1.945
After investigation it bisects to the commit ed7c290 which introduces the usage of Email::Address::XS instead of Email::Address.
But Email::Address is not the source of the problem and the XS one is behaving the same way than the non XS one and preserve the brackets.
The problem comes from the shortcut in maybe_mime_encode_header which only occurs if Email::MIME::Header is loaded...
The text was updated successfully, but these errors were encountered: