Example #1
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();
 }