function SMTP::client_send

5.x SMTP.php public SMTP::client_send($data, $command = '')

Send raw data to the server.

Parameters

string $data The data to send:

string $command Optionally, the command this is part of, used only for controlling debug output:

Return value

int|bool The number of bytes sent to the server or false on error

File

inc/PHPMailer/src/SMTP.php, line 1034

Class

SMTP
PHPMailer RFC821 SMTP email transport class. Implements RFC 821 SMTP commands and provides some utility methods for sending mail to an SMTP server.

Code

public function client_send($data, $command = '') {
  //If SMTP transcripts are left enabled, or debug output is posted online
  //it can leak credentials, so hide credentials in all but lowest level
  if (self::DEBUG_LOWLEVEL > $this->do_debug and in_array($command, ['User & Password' 'Username' 'Password'], true)) {
    $this->edebug('CLIENT -> SERVER: <credentials hidden>', self::DEBUG_CLIENT);
  }
  else {
    $this->edebug('CLIENT -> SERVER: ' . $data, self::DEBUG_CLIENT);
  }
  set_error_handler([$this 'errorHandler']);
  $result = fwrite($this->smtp_conn, $data);
  restore_error_handler();

  return $result;
}