Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Olá amigos!! http://forum.imasters.com.br/public/style_emoticons/default/thumbsup.gif
Estou com problemas na miinha classe smtp que dá
o seguinte erro:
Warning: fsockopen() [function.fsockopen]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/sasmet/public_html/smtp.class.php on line 9
Warning: fsockopen() [function.fsockopen]: unable to connect to smtp.sasmet.com.br:25 (Unknown error) in /home/sasmet/public_html/smtp.class.php on line 9
Warning: fputs(): supplied argument is not a valid stream resource in /home/sasmet/public_html/smtp.class.php on line 35
logo abaixo o código..
CODE
<?class Smtp{
var $conn;
var $user;
var $pass;
var $debug;
function Smtp($host){
$this->conn = fsockopen($host, 25, $errno, $errstr, 30);
$this->Put("EHLO $host");
}
function Auth(){
$this->Put("AUTH LOGIN");
$this->Put(base64_encode($this->user));
$this->Put(base64_encode($this->pass));
}
function Send($to, $from, $subject, $msg){
$this->Auth();
$this->Put("MAIL FROM: " . $from);
$this->Put("RCPT TO: " . $to);
$this->Put("DATA");
$this->Put($this->toHeader($to, $from, $subject));
$this->Put("\r\n");
$this->Put($msg);
$this->Put(".");
$this->Close();
if(isset($this->conn)){
return true;
}else{
return false;
}
}
function Put($value){
return fputs($this->conn, $value . "\r\n");
}
function toHeader($to, $from, $subject){
$header = "Message-Id: <". date('YmdHis').".". md5(microtime()).".". strtoupper($from) ."> \r\n";
$header .= "From: <" . $from . "> \r\n";
$header .= "To: <".$to."> \r\n";
$header .= "Subject: ".$subject." \r\n";
$header .= "Date: ". date('D, d M Y H:i:s O') ." \r\n";
$header .= "X-MSMail-Priority: High \r\n";
$header .= "Content-Type: Text/HTML";
return $header;
}
function Close(){
$this->Put("QUIT");
if($this->debug == true){
while (!feof ($this->conn)) {
fgets($this->conn) . "<br>\n";
}
}
return fclose($this->conn);
}
}
?>
Agradeço muito quem puder ajudar..já tô quase louco e não consigo
descobrir o erro.. :wacko:
Carregando comentários...