/** * Prepares the `from` email address. * * @return array */ protected function _prepareFromAddress() { $from = $this->_cakeEmail->returnPath(); if (empty($from)) { $from = $this->_cakeEmail->from(); } return $from; }
/** * testRcptWithReturnPath method * * @return void */ public function testRcptWithReturnPath() { $email = new Email(); $email->from('*****@*****.**', 'CakePHP Test'); $email->to('*****@*****.**', 'CakePHP'); $email->returnPath('*****@*****.**', 'CakePHP Return'); $this->socket->expects($this->at(0))->method('write')->with("MAIL FROM:<*****@*****.**>\r\n"); $this->socket->expects($this->at(1))->method('read')->will($this->returnValue(false)); $this->socket->expects($this->at(2))->method('read')->will($this->returnValue("250 OK\r\n")); $this->socket->expects($this->at(3))->method('write')->with("RCPT TO:<*****@*****.**>\r\n"); $this->socket->expects($this->at(4))->method('read')->will($this->returnValue(false)); $this->socket->expects($this->at(5))->method('read')->will($this->returnValue("250 OK\r\n")); $this->SmtpTransport->setEmail($email); $this->SmtpTransport->sendRcpt(); }
/** * Prepares the `from` email address. * * @param \Cake\Network\Email\Email $email Email instance * @return array */ protected function _prepareFromAddress($email) { $from = $email->returnPath(); if (empty($from)) { $from = $email->from(); } return $from; }