-
-
Notifications
You must be signed in to change notification settings - Fork 145
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
in_reply_to treated as an iterable object, but its not #26
Comments
One possible solution is : private function parseAddresses($list) {
$addresses = [];
$list = ( is_array( $list ) || $list instanceof Traversable ) ? $list : [$list];
foreach ($list as $item) {
[...] but i somehow don't like the fact were just assuming it should be an parseable email address then .... |
Hi @DasTobbel , Best regards, |
I think it would be the easiest and most compliant way for the stated issue. Aftermath: src/Message.php:77
* @method array setInReplyTo(array $in_reply_to) in RFC 2822 it should always be set as exactly one message identifier: But RFC 4021 says: |
So the correct way would be to support both and remove the "address" parsing part since it isn't required at all. |
Did a bit of reading and research in my mails:
I conclude, to be fully "rfc" there should be a setter and getter for a single message id and for an array of those... // $in_reply_to | single message id format (<messageid@host>) or array of message ids
setInReplyTo( $in_reply_to ) {
if ( is_array($in_reply_to ) ) {
$this->in_reply_to = implode(', ', $in_reply_to);
} else {
$this->in_reply_to = $in_reply_to;
}
}
getInReplyTo(){
if ( strpos( $this->in_reply_to, ',') !== false) {
return explode(',' ,$this->in_reply_to);
} else {
return $this->in_reply_to:
}
}
? |
@DasTobbel thanks for all the time spend on the research. I'm all in one the setter method 👍 But I kind of don't like the mixed response in getInReplyTo(). I think it would be better to either always return an array or a string. Or introduce a new config option to set the desired output format. Like Best regards, |
Hi @DasTobbel , if (property_exists($header, 'in_reply_to')) {
$this->attributes["in_reply_to"] = is_array($header->in_reply_to) ? $header->in_reply_to : [$header->in_reply_to];
} in |
I like that! As you said its nice for us users that we can rely on the responses - and we don't need to evaluate how to handle the response. |
Describe the bug
Kinda two bugs in one:
In
src/Header.php:475
theHeader::parseAddresses($list)
function requires the given $list to be an iterable object, in the case of the "in_reply_to" header, this will only happen if there was an ongoing discussion based on one mail.The more common case (probably?) is that it references the one mail on which the current mail responds to.
In
src/Header.php:460
theHeader::extractAddresses($header)
function wants to parse the in_reply_to header key as an email address, but it should not be a valid email address per RFC, it should be a message identifier, see :https://tools.ietf.org/html/rfc2822
3.6.4. Identification fields
Dont know if still want to parse it to an array with some selectable fields, but should work if the bug 1 is solved.
To Reproduce
have a answered mail in your inbox, try to recieve. The Mail needs to be the first answer
Expected behavior
A clear and concise description of what you expected to happen.
Desktop / Server (please complete the following information):
The text was updated successfully, but these errors were encountered: