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

Fixes ddeboer/imap#66 #67

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions src/Ddeboer/Imap/Message/Headers.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,48 @@ public function __construct(\stdClass $headers)
} else {
$this->array['to'] = array();
}

if (isset($this->array['cc'])) {
$recipients = array();
foreach ($this->array['cc'] as $cc) {
$recipients[] = new EmailAddress(
str_replace('\'', '', $cc->mailbox),
str_replace('\'', '', $cc->host),
isset($cc->personal) ? \imap_utf8($cc->personal) : null
);
}
$this->array['cc'] = $recipients;
} else {
$this->array['cc'] = array();
}

if (isset($this->array['sender'])) {
$senders = array();
foreach ($this->array['sender'] as $sender) {
$senders[] = new EmailAddress(
str_replace('\'', '', $sender->mailbox),
str_replace('\'', '', $sender->host),
isset($sender->personal) ? \imap_utf8($sender->personal) : null
);
}
$this->array['sender'] = $senders;
} else {
$this->array['sender'] = array();
}

if (isset($this->array['reply_to'])) {
$recipients = array();
foreach ($this->array['reply_to'] as $reply_to) {
$recipients[] = new EmailAddress(
str_replace('\'', '', $reply_to->mailbox),
str_replace('\'', '', $reply_to->host),
isset($reply_to->personal) ? \imap_utf8($reply_to->personal) : null
);
}
$this->array['reply_to'] = $recipients;
} else {
$this->array['reply_to'] = array();
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do these changes have to do with the encoding fix?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was supposed to be different pull request, but It merge to one pull request. I don't know why

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand. Could you undo the last commit so we keep this PR clean?

}

public function current()
Expand Down
2 changes: 1 addition & 1 deletion src/Ddeboer/Imap/Message/Part.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public function getDecodedContent()
break;

case self::ENCODING_QUOTED_PRINTABLE:
$this->decodedContent = \utf8_encode(\quoted_printable_decode($this->getContent()));
$this->decodedContent = \iconv($this->getCharset(), 'UTF-8', \quoted_printable_decode($this->getContent()));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let’s use mb_convert_encoding() instead, as we’re already using that elsewhere in this library.

break;

case self::ENCODING_7BIT:
Expand Down