/** * SMTP MAIL FROM * SUCCESS 250 * @return $this * @throws CodeException * @throws SMTPException */ protected function mailFrom() { $in = "MAIL FROM:<{$this->message->getFromEmail()}>" . $this->CRLF; $code = $this->pushStack($in); if ($code !== '250') { throw new CodeException('250', $code, array_pop($this->resultStack)); } return $this; }
public function send(Message $message) { $in = $message->toString(); $email = !is_null($message->getFakeFromEmail()) ? $message->getFakeFromEmail() : $message->getFromEmail(); // is popen() enabled? if (!function_exists('popen') || FALSE === ($fp = @popen($this->mailpath . ' -oi -f ' . $email . ' -t -r ' . $email, 'w'))) { // server probably has popen disabled, so nothing we can do to get a verbose error. throw new SendException('The message could not be delivered using sendmail. The function popen() is disabled.'); } fputs($fp, $message->headersToString()); fputs($fp, $in); $status = pclose($fp); if ($status !== 0) { throw new SendException('Cannot open a socket to Sendmail. Check settings. Status code: ' . $status . '.'); } $this->logger && $this->logger->addDebug('Sent: ' . $message->getHeader('To')); return true; }