Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Boa tarde a todos,
Estou tendo problema em enviar uma cópia do email gerado pelo site para o visitante, segue o código.
<?php
class Smtp{
var $conn;
var $user;
var $pass;
var $debug = false;
function Smtp($host){
$this->conn = fsockopen($host, 587, $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, $msge){
$this->Auth();
$this->Put("MAIL FROM: " . $from);
$this->Put("RCPT TO: " . $to);
$THIS->pUT("CC: " . $from);
$this->Put("DATA");
$this->Put($this->toHeader($to, $from, $subject));
$this->Put("\r\n");
$this->Put("O valor do seu orçamento é de R$ " . number_format( (float) $msge, 2, ',', '.' ));
$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 .= "To: <".$to."> \r\n";
$header .= "CC: <".$from."> \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";
return $header;
}
function Close(){
$this->Put("QUIT");
if($this->debug == true){
while (!feof ($this->conn)) {
echo fgets($this->conn) . "<br>\n";
}
}
return fclose($this->conn);
}
}
?>
Agradeço a força de todos.
Carregando comentários...