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;
 }
Ejemplo 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();
 }
Ejemplo n.º 3
0
 public function testSendBase64MultipartMail()
 {
     $headers = "From: foo@foo.com\r\n" . "Content-Type: multipart/mixed; boundary=\"a-boundary\"\r\n";
     $message = "--a-boundary\r\n" . "Content-Type: text/plain\r\n" . "\r\n" . "multipart mail\r\n" . "--a-boundary\r\n" . "Content-Type: text/plain\r\n" . "Content-Transfer-Encoding: base64\r\n" . "Content-Disposition: attachment; filename=\"first.txt\"\r\n" . "\r\n" . base64_encode('base64-encoded message') . "\r\n" . "--a-boundary--\r\n";
     $message_proto = new MailMessage();
     $message_proto->setSender('*****@*****.**');
     $message_proto->addTo('*****@*****.**');
     $message_proto->setSubject('subject');
     $message_proto->setTextBody('multipart mail');
     $attachment1 = $message_proto->addAttachment();
     $attachment1->setFilename('first.txt');
     $attachment1->setData('base64-encoded message');
     $response = new VoidProto();
     $this->apiProxyMock->expectCall('mail', 'Send', $message_proto, $response);
     $ret = Mail::sendMail('*****@*****.**', 'subject', $message, $headers);
     $this->assertTrue($ret);
     $this->apiProxyMock->verify();
 }