If the given name is not existing it opens the default inbox.
function(string $folder = NULL)
{
if ($this->_is_connected()) {
if (!$folder || ($this->folder === $folder)) {
return $folder ?: $this->folder;
}
if (\in_array($folder, $this->getAllNamesFolders())) {
$res = imap_reopen($this->stream, $this->mbParam . $folder);
}
else {
$res = imap_reopen($this->stream, $folder);
}
if ($res) {
if (!isset($this->folders[$folder])) {
$this->folders[$folder] = [
'last_uid' => null,
'num_msg' => null,
'last_check' => null
];
}
$this->folder = $folder;
return $folder;
}
}
return null;
}