Skip to content

Commit f22d863

Browse files
committed
Don't set the charset if it isn't used - prevent strange outlook mail server errors #100
1 parent 4fd65cf commit f22d863

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/IMAP/Query/Query.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,16 @@ public function get() {
119119

120120
try {
121121
$this->generate_query();
122-
$available_messages = imap_search($this->getClient()->getConnection(), $this->getRawQuery(), SE_UID, $this->getCharset());
122+
123+
/**
124+
* Don't set the charset if it isn't used - prevent strange outlook mail server errors
125+
* @see https://github.com/Webklex/laravel-imap/issues/100
126+
*/
127+
if($this->getCharset() === null){
128+
$available_messages = imap_search($this->getClient()->getConnection(), $this->getRawQuery(), SE_UID);
129+
}else{
130+
$available_messages = imap_search($this->getClient()->getConnection(), $this->getRawQuery(), SE_UID, $this->getCharset());
131+
}
123132

124133
if ($available_messages !== false) {
125134

0 commit comments

Comments
 (0)