private function setUpAttachmentMessageProto()
 {
     $message_proto = new MailMessage();
     $message_proto->setSender("*****@*****.**");
     $message_proto->setReplyto("*****@*****.**");
     $message_proto->setSubject("test");
     $message_proto->setTextbody("text body");
     $message_proto->setHtmlbody("html body");
     $header = $message_proto->addHeader();
     $header->setName("in-reply-to");
     $header->setValue("data");
     $header = $message_proto->addHeader();
     $header->setName("list-id");
     $header->setValue("data2");
     $header = $message_proto->addHeader();
     $header->setName("references");
     $header->setValue("data3");
     $attach = $message_proto->addAttachment();
     $attach->setFilename("test.gif");
     $attach->setData("data");
     $attach = $message_proto->addAttachment();
     $attach->setFilename("t.jpg");
     $attach->setData("data2");
     $attach = $message_proto->addAttachment();
     $attach->setFilename("z.png");
     $attach->setData("data3");
     return $message_proto;
 }
Exemplo n.º 2
0
 public function testSucceedWithOptionsArray()
 {
     $headers = array('in-reply-to' => 'data', 'list-id' => 'data2', 'references' => 'data3');
     $attachments = array('test.gif' => 'data', 't.jpg' => 'data2', 'z.png' => 'data3');
     $options = array('sender' => '*****@*****.**', 'replyto' => '*****@*****.**', 'to' => array('*****@*****.**', '*****@*****.**'), 'cc' => array('*****@*****.**', '*****@*****.**'), 'bcc' => array('*****@*****.**', '*****@*****.**'), 'subject' => 'test', 'textBody' => 'text body', 'htmlBody' => 'html body', 'header' => $headers, 'attachment' => $attachments);
     $message = new Message($options);
     $message_proto = new MailMessage();
     $message_proto->setSender("*****@*****.**");
     $message_proto->setReplyto("*****@*****.**");
     $message_proto->addTo("*****@*****.**");
     $message_proto->addTo("*****@*****.**");
     $message_proto->addCc("*****@*****.**");
     $message_proto->addCc("*****@*****.**");
     $message_proto->addBcc("*****@*****.**");
     $message_proto->addBcc("*****@*****.**");
     $message_proto->setSubject("test");
     $message_proto->setTextbody("text body");
     $message_proto->setHtmlbody("html body");
     $header = $message_proto->addHeader();
     $header->setName("in-reply-to");
     $header->setValue("data");
     $header = $message_proto->addHeader();
     $header->setName("list-id");
     $header->setValue("data2");
     $header = $message_proto->addHeader();
     $header->setName("references");
     $header->setValue("data3");
     $attach = $message_proto->addAttachment();
     $attach->setFilename("test.gif");
     $attach->setData("data");
     $attach = $message_proto->addAttachment();
     $attach->setFilename("t.jpg");
     $attach->setData("data2");
     $attach = $message_proto->addAttachment();
     $attach->setFilename("z.png");
     $attach->setData("data3");
     $response = new VoidProto();
     $this->apiProxyMock->expectCall('mail', 'Send', $message_proto, $response);
     $message->send();
     $this->apiProxyMock->verify();
 }
Exemplo n.º 3
0
 public function testSendMailWithExtraHeaders()
 {
     $html = "<b>html</b>";
     $headers = "From: foo@foo.com\r\n" . "List-Id: 12345\r\n" . "On-Behalf-Of: bar2@bar.com\r\n" . "X-Mailer: foo";
     // Expected to be dropped.
     $message_proto = new MailMessage();
     $message_proto->setSender('*****@*****.**');
     $message_proto->addTo('*****@*****.**');
     $message_proto->setSubject('subject');
     $message_proto->setTextBody('text');
     $header = $message_proto->addHeader();
     $header->setName('list-id');
     $header->setValue('12345');
     $header = $message_proto->addHeader();
     $header->setName('on-behalf-of');
     $header->setValue('*****@*****.**');
     $response = new VoidProto();
     $this->apiProxyMock->expectCall('mail', 'Send', $message_proto, $response);
     $ret = Mail::sendMail('*****@*****.**', 'subject', 'text', $headers);
     $this->assertTrue($ret);
     $this->apiProxyMock->verify();
 }