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

add getBcc(), Set, Clear Flag(\Seen, \Answered, \Flagged, \Deleted, and \Draft), getHeadersRaw() #144

Merged
merged 10 commits into from
Sep 28, 2017
28 changes: 27 additions & 1 deletion src/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*/
class Message extends Message\Part
{
private $headersRaw;
private $headers;
private $rawHeaders;
private $attachments;
Expand Down Expand Up @@ -136,7 +137,12 @@ public function getNumber(): int
*/
public function getDate(): \DateTimeImmutable
{
return $this->getHeaders()->get('date');
$date = $this->getHeaders()->get('date');
if(!$date){
$udate = new \DateTime();
$date = $udate->setTimestamp($this->getHeaders()->get('udate'));
}
return $date;
}

/**
Expand Down Expand Up @@ -398,4 +404,24 @@ private function loadStructure()

$this->parseStructure($structure);
}

/**
* Set Flag Message
* @param [type] $flag \Seen, \Answered, \Flagged, \Deleted, and \Draft
* @return bool [description]
*/
public function setFlag($flag)
{
return imap_setflag_full($this->stream, $this->messageNumber, $flag, ST_UID);
}

/**
* Clear Flag Message
* @param [type] $flag \Seen, \Answered, \Flagged, \Deleted, and \Draft
* @return bool [description]
*/
public function clearFlag($flag)
{
return imap_clearflag_full($this->stream, $this->messageNumber, $flag, ST_UID);
}
}