本文整理汇总了PHP中Swift_Transport_EsmtpTransport::send方法的典型用法代码示例。如果您正苦于以下问题:PHP Swift_Transport_EsmtpTransport::send方法的具体用法?PHP Swift_Transport_EsmtpTransport::send怎么用?PHP Swift_Transport_EsmtpTransport::send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Swift_Transport_EsmtpTransport
的用法示例。
在下文中一共展示了Swift_Transport_EsmtpTransport::send方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testExtensionsCanModifyRcptParams
public function testExtensionsCanModifyRcptParams()
{
$buf = $this->_getBuffer();
$dispatcher = $this->_createEventDispatcher();
$smtp = new Swift_Transport_EsmtpTransport($buf, array(), $dispatcher);
$ext1 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();
$ext2 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();
$ext3 = $this->getMockery('Swift_Transport_EsmtpHandler')->shouldIgnoreMissing();
$message = $this->_createMessage();
$message->shouldReceive('getFrom')->zeroOrMoreTimes()->andReturn(array('me@domain' => 'Me'));
$message->shouldReceive('getTo')->zeroOrMoreTimes()->andReturn(array('foo@bar' => null));
$buf->shouldReceive('readLine')->once()->with(0)->andReturn("220 server.com foo\r\n");
$buf->shouldReceive('write')->once()->with('~^EHLO .+?\\r\\n$~D')->andReturn(1);
$buf->shouldReceive('readLine')->once()->with(1)->andReturn("250-ServerName.tld\r\n");
$buf->shouldReceive('readLine')->once()->with(1)->andReturn("250-AUTH PLAIN LOGIN\r\n");
$buf->shouldReceive('readLine')->once()->with(1)->andReturn("250 SIZE=123456\r\n");
$buf->shouldReceive('write')->once()->with("MAIL FROM:<me@domain>\r\n")->andReturn(2);
$buf->shouldReceive('readLine')->once()->with(2)->andReturn("250 OK\r\n");
$buf->shouldReceive('write')->once()->with("RCPT TO:<foo@bar> FOO ZIP\r\n")->andReturn(3);
$buf->shouldReceive('readLine')->once()->with(3)->andReturn("250 OK\r\n");
$this->_finishBuffer($buf);
$ext1->shouldReceive('getHandledKeyword')->zeroOrMoreTimes()->andReturn('AUTH');
$ext1->shouldReceive('getRcptParams')->once()->andReturn('FOO');
$ext1->shouldReceive('getPriorityOver')->zeroOrMoreTimes()->with('AUTH')->andReturn(-1);
$ext2->shouldReceive('getHandledKeyword')->zeroOrMoreTimes()->andReturn('SIZE');
$ext2->shouldReceive('getRcptParams')->once()->andReturn('ZIP');
$ext2->shouldReceive('getPriorityOver')->zeroOrMoreTimes()->with('AUTH')->andReturn(1);
$ext3->shouldReceive('getHandledKeyword')->zeroOrMoreTimes()->andReturn('STARTTLS');
$ext3->shouldReceive('getRcptParams')->never();
$smtp->setExtensionHandlers(array($ext1, $ext2, $ext3));
$smtp->start();
$smtp->send($message);
}