Skip to content

Commit 424b2c8

Browse files
committed
Merge pull request #2 from dashford/add-recipient-type
Add type to recipient and use this in the message struct
2 parents 3b8d9ed + 46a4f22 commit 424b2c8

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

src/Mandrill/Struct/Message.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,8 @@ public function setMetadata(array $metadata){
261261
public function addRecipient(Recipient $recipient){
262262
$this->to[] = array(
263263
'email' => $recipient->email,
264-
'name' => $recipient->name
264+
'name' => $recipient->name,
265+
'type' => $recipient->type
265266
);
266267
$this->merge_vars[] = array(
267268
'rcpt' => $recipient->email,

src/Mandrill/Struct/Recipient.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ class Recipient extends Struct{
2020
*/
2121
public $name;
2222

23+
/**
24+
* @var string the recipient's header type i.e. 'to', 'cc', 'bcc'
25+
*/
26+
public $type = 'to';
27+
2328
/**
2429
* @var array associative array of recipient-specific merge variables
2530
*/
@@ -33,14 +38,18 @@ class Recipient extends Struct{
3338
/**
3439
* @param string $email the recipient's email address
3540
* @param string $name the recipient's name
41+
* @param string $type the recipient's header type i.e. 'to', 'cc', 'bcc'
3642
*/
37-
function __construct($email = NULL, $name = NULL){
43+
function __construct($email = NULL, $name = NULL, $type = NULL){
3844
if(!is_null($email)){
3945
$this->email = $email;
4046
}
4147
if(!is_null($name)){
4248
$this->name = $name;
4349
}
50+
if(!is_null($type)){
51+
$this->type = $type;
52+
}
4453
}
4554

4655

@@ -105,4 +114,4 @@ public function setMetadata(array $metadata){
105114
public function getMetadata(){
106115
return $this->metadata;
107116
}
108-
}
117+
}

0 commit comments

Comments
 (0)