Socket 으로 이메일 보 내기(검증 이 필요 한 SMTP 서버 이용)
\r"; } } function send($from,$to,$subject,$body){if($from="|$to=="){exit("사서함 주 소 를 입력 하 십시오");}if($subject==")$sebject="제목 없 음";if($body == "") $body = "내용 없 음";$this->from = $from; $this->to = $to; $this->subject = $subject; $this->body = $body; $All = "From:".$this->from.""; $All .= "To:".$this->to.""; $All .= "Subject:".$this->subject.""; $All .= $this->body; /* $All 의 내용 을 더 처리 하면 MIME 메 일 을 보 낼 수 있 습 니 다. 하지만 많은 프로그램 이 필요 합 니 다*//다음은 서버 세 션$this->in = "EHLO HELO\r"; $this->docommand(); $this->in = "AUTH LOGIN\r"; $this->docommand(); $this->in = $this->user."\r"; $this->docommand(); $this->in = $this->pass."\r"; $this->docommand(); $this->in = "MAIL FROM:".$this->from."\r"; $this->docommand(); $this->in = "RCPT TO:".$this->to."\r"; $this->docommand(); $this->in = "DATA\r"; $this->docommand(); $this->in = $All."\r.\r"; $this->docommand(); $this->in = "QUIT\r"; $this->docommand(); //연결 종료 } function docommand() { socket_write ($this->socket, $this->in, strlen ($this->in)); $this->debug_show("클 라 이언 트 명령:".$this->in);$this->result_str="서버 응답:".socketread ($this->socket, 1024).""; $this->debug_show($this->result_str); } } //이것 은 내 가 한 테스트 입 니 다.나 는 smtp.163.com 을 사용 합 니 다.그러면 당신 의 우편함 도 163.com 이 어야 합 니 다.그렇지 않 으 면 다른 사람 이 당신 에 게 보 내지 못 하 게 해 야 합 니 다!!/당신 이 이 종 류 를 사용 할 때 당신 의 우편함 으로 수정 하면 됩 니 다$smtp = new smtp_mail("smtp.163.com","25","당신 의 163.com 계 정","당신 의 비밀번호");/세 션 정 보 를 표시 하려 면//$smtp 로 변경 하 십시오. = new smtp_mail("smtp.163.com","25","당신 의 163.com 계 정","당신 의 비밀번호",true);$smtp->send("당신 의 163.com 계 정@163.com","목표 주소","안녕하세요","안녕하세요");?>