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

Added support for "bcc" as a type of processed object. #19

Merged
merged 1 commit into from
Jul 28, 2013
Merged
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
18 changes: 14 additions & 4 deletions src/Fetch/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,19 +121,26 @@ class Message
protected $from;

/**
* This is an array of arrays that contain information about the addresses the email was cc'd to.
* This is an array of arrays that contains information about the addresses the email was sent to.
*
* @var array
*/
protected $to;

/**
* This is an array of arrays that contain information about the addresses the email was cc'd to.
* This is an array of arrays that contains information about the addresses the email was cc'd to.
*
* @var array
*/
protected $cc;

/**
* This is an array of arrays that contains information about the addresses the email was bcc'd to.
*
* @var array
*/
protected $bcc;

/**
* This is an array of arrays that contain information about the addresses that should receive replies to the email.
*
Expand Down Expand Up @@ -200,6 +207,9 @@ protected function loadMessage()
if (isset($headers->cc))
$this->cc = $this->processAddressObject($headers->cc);

if (isset($headers->bcc))
$this->bcc = $this->processAddressObject($headers->bcc);

$this->from = $this->processAddressObject($headers->from);
$this->replyTo = isset($headers->reply_to) ? $this->processAddressObject($headers->reply_to) : $this->from;

Expand Down Expand Up @@ -316,13 +326,13 @@ public function getMessageBody($html = false)
* This function returns either an array of email addresses and names or, optionally, a string that can be used in
* mail headers.
*
* @param string $type Should be 'to', 'cc', 'from', or 'reply-to'.
* @param string $type Should be 'to', 'cc', 'bcc', 'from', or 'reply-to'.
* @param bool $asString
* @return array|string|bool
*/
public function getAddresses($type, $asString = false)
{
$addressTypes = array('to', 'cc', 'from', 'reply-to');
$addressTypes = array('to', 'cc', 'bcc', 'from', 'reply-to');

if (!in_array($type, $addressTypes) || !isset($this->$type) || count($this->$type) < 1)
return false;
Expand Down