You are here

function PHPMailer::SendmailSend in SMTP Authentication Support 5

Sends mail using the $Sendmail program. @access private

Return value

bool

1 call to PHPMailer::SendmailSend()
PHPMailer::Send in ./smtp.module
Creates message and assigns Mailer. If the message is not sent successfully then it returns false. Use the ErrorInfo variable to view description of the error.

File

./smtp.module, line 840
Enables drupal to send email directly to an SMTP server using authentication. Uses the PHPMailer class by Brent R. Matzelle.

Class

PHPMailer
PHPMailer - PHP email transport class @package PHPMailer @author Brent R. Matzelle @copyright 2001 - 2003 Brent R. Matzelle

Code

function SendmailSend($header, $body) {
  if ($this->Sender != "") {
    $sendmail = sprintf("%s -oi -f %s -t", $this->Sendmail, $this->Sender);
  }
  else {
    $sendmail = sprintf("%s -oi -t", $this->Sendmail);
  }
  if (!@($mail = popen($sendmail, "w"))) {
    $this
      ->SetError($this
      ->Lang("execute") . $this->Sendmail);
    return false;
  }
  fputs($mail, $header);
  fputs($mail, $body);
  $result = pclose($mail) >> 8 & 0xff;
  if ($result != 0) {
    $this
      ->SetError($this
      ->Lang("execute") . $this->Sendmail);
    return false;
  }
  return true;
}