public function data($data)
    {
        if ($this->_rcpt == false) {
            throw new SMTPException(__('Must call RCPT before calling DATA'));
        }

        $this->_send('DATA');
        $this->_expect(354, 120);

        foreach ($this->_header_fields as $name => $body) {
            // Every header can contain an array. Will insert multiple header fields of that type with the contents of array.
            // Useful for multiple recipients, for instance.
            if (!is_array($body)) {
                $body = array($body);
            }

            foreach ($body as $val) {
                $this->_send($name . ': ' . $val);
            }
        }
        // Send an empty newline. Solves bugs with Apple Mail
        $this->_send('');

        // Because the message can contain \n as a newline, replace all \r\n with \n and explode on \n.
        // The send() function will use the proper line ending (\r\n).
        $data = str_replace("\r\n", "\n", $data);
        $data_arr = explode("\n", $data);

        foreach ($data_arr as $line) {
            // Escape line if first character is a period (dot). http://tools.ietf.org/html/rfc2821#section-4.5.2
            if (strpos($line, '.') === 0) {
                $line = '.' . $line;
            }
            $this->_send($line);
        }

        $this->_send('.');
        $this->_expect(250, 600);
        $this->_data = true;
    }
public function data($data)
    {
        if ($this->_rcpt == false) {
            throw new SMTPException(__('Must call RCPT before calling DATA'));
        }

        $this->_send('DATA');
        $this->_expect(354, 120);

        foreach ($this->_header_fields as $name => $body) {
            // Every header can contain an array. Will insert multiple header fields of that type with the contents of array.
            // Useful for multiple recipients, for instance.
            if (!is_array($body)) {
                $body = array($body);
            }

            foreach ($body as $val) {
                $this->_send($name . ': ' . $val);
            }
        }
        // Send an empty newline. Solves bugs with Apple Mail
        $this->_send('');

        // Because the message can contain \n as a newline, replace all \r\n with \n and explode on \n.
        // The send() function will use the proper line ending (\r\n).
        $data = str_replace("\r\n", "\n", $data);
        $data_arr = explode("\n", $data);

        foreach ($data_arr as $line) {
            // Escape line if first character is a period (dot). http://tools.ietf.org/html/rfc2821#section-4.5.2
            if (strpos($line, '.') === 0) {
                $line = '.' . $line;
            }
            $this->_send($line);
        }

        $this->_send('.');
        $this->_expect(250, 600);
        $this->_data = true;
    }
public function data ( $ data ) { if ( $ this -> _rcpt == false ) { throw new SMTPException ( __ ( 'Must call RCPT before calling DATA' ) ) ; } $ this -> _send ( 'DATA' ) ; $ this -> _expect ( 354 , 120 ) ; foreach ( $ this -> _header_fields as $ name => $ body ) { // Every header can contain an array. Will insert multiple header fields of that type with the contents of array. // Useful for multiple recipients, for instance. if ( ! is_array ( $ body ) ) { $ body = array ( $ body ) ; } foreach ( $ body as $ val ) { $ this -> _send ( $ name . ': ' . $ val ) ; } } // Send an empty newline. Solves bugs with Apple Mail $ this -> _send ( '' ) ; // Because the message can contain \n as a newline, replace all \r\n with \n and explode on \n. // The send() function will use the proper line ending (\r\n). $ data = str_replace ( "\r\n" , "\n" , $ data ) ; $ data_arr = explode ( "\n" , $ data ) ; foreach ( $ data_arr as $ line ) { // Escape line if first character is a period (dot). http://tools.ietf.org/html/rfc2821#section-4.5.2 if ( strpos ( $ line , '.' ) === 0 ) { $ line = '.' . $ line ; } $ this -> _send ( $ line ) ; } $ this -> _send ( '.' ) ; $ this -> _expect ( 250 , 600 ) ; $ this -> _data = true ; }
Calls the data command on the server.
Also includes header fields in the command.

@throws SMTPException
@param string $data
@return void
Calls the data command on the server . Also includes header fields in the command .