/** * parse header of current mail message * * @since 0.1 * @access protected * @return void * @param MailMessage $mail */ protected function _parseHeader(MailMessage $mail) { $data = imap_header($this->handle, $this->current); $mail->setMessageId($data->message_id); $mail->setSubject($data->subject); $mail->setDate($data->date); $from = $this->_transformAdress($data->from[0]); $seen = $data->Recent == 'N' || $data->Unseen == 'U' ? false : true; $mail->setFrom($from[0], $from[1]); $mail->setRecent($data->Recent == '' ? false : true); $mail->setSeen($seen); if (isset($data->to)) { foreach ($data->to as $adress) { $adress = $this->_transformAdress($adress); $mail->addTo($adress[0], $adress[1]); } } if (isset($data->cc)) { foreach ($data->cc as $adress) { $adress = $this->_transformAdress($adress); $mail->addCc($adress[0], $adress[1]); } } if (isset($data->bcc)) { foreach ($data->bcc as $adress) { $adress = $this->_transformAdress($adress); $mail->addBcc($adress[0], $adress[1]); } } if (isset($data->return_path)) { foreach ($data->return_path as $adress) { $adress = $this->_transformAdress($adress); $mail->addReplyTo($adress[0], $adress[1]); } } }