_path; } /** * * set the path of the sendmail application * * @param string $path * @return \Cube\Mail\Transport\Sendmail */ public function setPath($path) { $this->_path = $path; return $this; } /** * * send mail method * * @throws \RuntimeException * @return bool */ public function send() { $result = false; $mail = $this->getMail(); $mailHeader = $mail->createHeader(); $mailBody = $mail->getBody(); $from = $mail->getFrom(); $sendmail = sprintf("%s -oi -f%s -t", escapeshellcmd($this->_path), escapeshellarg($from['address'])); foreach ($mail->getTo() as $to) { if (!@$mail = popen($sendmail, 'w')) { throw new \RuntimeException(sprintf( "Could not execute sendmail program, path given: '%s'.", $this->_path)); } fputs($mail, "To: " . $to['address'] . "\n"); fputs($mail, $mailHeader . "\n"); fputs($mail, $mailBody . "\n"); $result = pclose($mail); } $result = ($result == 0) ? true : false; return $result; } }