コード例 #1
0
 public function testSend()
 {
     $this->getServer()->enqueue($this->getMockResponse('send')->getMessage());
     $recipient = new Recipient();
     $recipient->email = '*****@*****.**';
     $recipient->name = 'Recipient Name';
     $recipient->addMergeVar('NAME', $recipient->name);
     $message = new Message();
     $message->addRecipient($recipient);
     $message->text = 'Hello, *|NAME|*!';
     $message->subject = 'Test';
     $message->from_email = '*****@*****.**';
     $message->from_name = 'Mandrill API Test';
     $response = $this->messages->send($message);
     $this->assertGreaterThan(0, sizeof($response));
     $this->assertEquals('sent', $response[0]['status']);
 }
コード例 #2
0
ファイル: Message.php プロジェクト: jlinn/mandrill-api-php
 /**
  * Add a recipient to this message
  * @param Recipient $recipient
  * @return $this
  */
 public function addRecipient(Recipient $recipient)
 {
     $this->to[] = array('email' => $recipient->email, 'name' => $recipient->name, 'type' => $recipient->type);
     $this->merge_vars[] = array('rcpt' => $recipient->email, 'vars' => $recipient->getMergeVars());
     $this->recipient_metadata[] = array('rcpt' => $recipient->email, 'values' => $recipient->getMetadata());
     return $this;
 }