Zend_Mail::getReturnPath PHP Method

getReturnPath() public method

If no Return-Path header is set, returns the value of {@link $_from}.
public getReturnPath ( ) : string
return string
    public function getReturnPath()
    {
        if (null !== $this->_returnPath) {
            return $this->_returnPath;
        }
        return $this->_from;
    }

Usage Example

Example #1
0
 public function testReturnPath()
 {
     $mail = new Zend_Mail();
     $res = $mail->setBodyText('This is a test.');
     $mail->setFrom('*****@*****.**', 'test Mail User');
     $mail->setSubject('My Subject');
     $mail->addTo('*****@*****.**');
     $mail->addTo('*****@*****.**');
     $mail->addBcc('*****@*****.**');
     $mail->addBcc('*****@*****.**');
     $mail->addCc('*****@*****.**', 'Example no. 1 for cc');
     $mail->addCc('*****@*****.**', 'Example no. 2 for cc');
     // First example: from and return-path should be equal
     $mock = new Zend_Mail_Transport_Mock();
     $mail->send($mock);
     $this->assertTrue($mock->called);
     $this->assertEquals($mail->getFrom(), $mock->returnPath);
     // Second example: from and return-path should not be equal
     $mail->setReturnPath('*****@*****.**');
     $mock = new Zend_Mail_Transport_Mock();
     $mail->send($mock);
     $this->assertTrue($mock->called);
     $this->assertNotEquals($mail->getFrom(), $mock->returnPath);
     $this->assertEquals($mail->getReturnPath(), $mock->returnPath);
     $this->assertNotEquals($mock->returnPath, $mock->from);
 }
All Usage Examples Of Zend_Mail::getReturnPath