'smtp' => array( 'host' => 'smtp.gmail.com', 'port' => 465, 'username' => 'my-account@gmail.com', 'password' => 'my-password', 'timeout' => 5, ), /** * Newline */ 'newline' => "\r\n",
/** * Connects to the given smtp and says hello to the other server. */ protected function smtp_connect() { $this->smtp_connection = @fsockopen( $this->config['smtp']['host'], $this->config['smtp']['port'], $error_number, $error_string, $this->config['smtp']['timeout'] );
// connect by socket with HOST:PORT. (try TIMEOUT seconds) if ($fp = @fsockopen(HOST, PORT, err_no, err_str, TIMEOUT)) { // after connected, set timeout 5 seconds. socket_set_timeout($fp, 5); // get meta data of the socket $socket_data_arr = stream_get_meta_data($fp); // sending socket fputs($fp, $hoge); // when there are response, get them $buf = "" // if $socket_data_arr[time_out"] is true, sending is timeout while (!feof($fp) && !$socket_data_arr["time_out"]) { $buf .= fgets($fp, 1024); } fclose($fp); }
It looks like you're new here. If you want to get involved, click one of these buttons!