conexão: 220 scorpion1.uol.com.br ESMTP
loop: 250-scorpion1.uol.com.br
loop: 250-PIPELINING
loop: 250-SIZE 13312000
loop: 250-VRFY
loop: 250-ETRN
loop: 250 8BITMIME
Edição feita por: mestre fyoda, 22/01/2006, 11:59.
Posted 22/01/2006, 10:19
Edição feita por: mestre fyoda, 22/01/2006, 11:59.
Posted 22/01/2006, 10:34
Posted 22/01/2006, 10:38
Posted 22/01/2006, 10:46
Posted 22/01/2006, 10:49
Posted 22/01/2006, 11:03
Posted 22/01/2006, 12:09
<? function authSendEmail() { //SMTP + SERVER DETAILS $email = $_POST['email']; /* * * * CONFIGURATION START * * * */ $smtpServer = "smtp.bol.com.br"; // SMTP DO SERVIDOR $port = "25"; // PORTA DO SERVIDOR SMTP ( padrão e 25 ) $timeout = "30"; // TEMPO DE RESPOSTA DO SERVIDOR $username = "chatoman"; // USUARIO ( EMAIL CADASTRADO NO SERVIDOR SMTP INDICADO ACIMA $password = "****"; // SENHA $localhost = "localhost"; // SERVIDOR do PHP+APACHE/ISS (localhost como padrão) $newLine = "\r\n"; // QUEBRA DE LINHA /* * * * CONFIGURATION END * * * * */ //Connect to the host on the specified port $smtpConnect = fsockopen($smtpServer, $port, $errno, $errstr, $timeout); $smtpResponse = fgets($smtpConnect, 515); if(empty($smtpConnect)) { $output = "Failed to connect: $smtpResponse"; return $output; } else { $logArray['connection'] = "Connected: $smtpResponse"; } //Request Auth Login fputs($smtpConnect,"AUTH LOGIN" . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['authrequest'] = "$smtpResponse"; //Send username fputs($smtpConnect, base64_encode($username) . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['authusername'] = "$smtpResponse"; //Send password fputs($smtpConnect, base64_encode($password) . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['authpassword'] = "$smtpResponse"; //Say Hello to SMTP fputs($smtpConnect, "HELO $localhost" . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['heloresponse'] = "$smtpResponse"; //Email From fputs($smtpConnect, "MAIL FROM: $from" . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['mailfromresponse'] = "$smtpResponse"; //Email To fputs($smtpConnect, "RCPT TO: $to" . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['mailtoresponse'] = "$smtpResponse"; //The Email fputs($smtpConnect, "DATA" . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['data1response'] = "$smtpResponse"; //Construct Headers $headers = "MIME-Version: 1.0" . $newLine; $headers .= "Content-type: text/html; charset=iso-8859-1" . $newLine; $headers .= "From: $namefrom" . $newLine; fputs($smtpConnect, "To: $to\nSubject: $subject\n$headers\n\n$message\n.\n"); $smtpResponse = fgets($smtpConnect, 515); $logArray['data2response'] = "$smtpResponse"; // Say Bye to SMTP fputs($smtpConnect,"QUIT" . $newLine); $smtpResponse = fgets($smtpConnect, 515); $logArray['quitresponse'] = "$smtpResponse"; } ?>
Edição feita por: mestre fyoda, 22/01/2006, 12:09.
Posted 23/01/2006, 06:48
Posted 23/01/2006, 15:14
cadastrar.php
<?
include ("smtp.php");
$from = $_POST['email'];
$to = "chatoman@itelefonica.com.br";
$sunject = "Teste de utilização de classe de uso";
$msg = "Recebendo o teste";
$smtp = new Smtp("smtp.itelefonica.com.br");
$smtp->user = "chatoman@itelefonica.com.br";
$smtp->pass = "xxxx";
$smtp->debug = false;
if($smtp->Send($to, $from, $subject, $msg)){
echo "enviou";
}else{
echo "falha ao enviar;_;";
}
?>
smtp.php
<?
class Smtp{
var $conn;
var $user;
var $pass;
var $debug = true;
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";
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);
}
}
?>
Edição feita por: mestre fyoda, 23/01/2006, 23:14.
Posted 23/01/2006, 16:19
Posted 23/01/2006, 16:33
essa chamada nao deu certo .nomedafunção()
Edição feita por: mestre fyoda, 23/01/2006, 16:35.
Posted 23/01/2006, 16:51
Edição feita por: helio_ceara, 23/01/2006, 16:53.
Posted 23/01/2006, 22:22
Posted 24/01/2006, 06:23
primeiro : copia novamente o código da página que o vidaloka passou pq vc já zoneou tudocomo verifico se a porta é 25 da itelefonica , eles nao dao essas informações
como faço para chamar aquela função , eu tentei chamar mas nao deu certo .essa chamada nao deu certo .nomedafunção()
Posted 24/01/2006, 15:16
<?
include ("smtp.php");
$nameto = $_POST['nome'];
$namefrom = "Rafael";
$from = "familiasimpson@uol.com.br";
$to = $_POST['email'];
$subject = "Teste de utilização de classe de uso";
$message = "Recebendo o teste";
authSendEmail($from, $namefrom, $to, $nameto, $subject, $message);
function authSendEmail($from, $namefrom, $to, $nameto, $subject, $message) {
//SMTP + SERVER DETAILS
/* * * * CONFIGURATION START * * * */
$smtpServer = "smtps.uol.com.br"; // SMTP DO SERVIDOR
$port = "25"; // PORTA DO SERVIDOR SMTP ( padrão e 25 )
$timeout = "30"; // TEMPO DE RESPOSTA DO SERVIDOR
$username = "familiasimpson@uol.com.br"; // USUARIO ( EMAIL CADASTRADO NO SERVIDOR SMTP INDICADO ACIMA
$password = "xxxx"; // SENHA
$localhost = "localhost"; // SERVIDOR do PHP+APACHE/ISS (localhost como padrão)
$newLine = "\r\n"; // QUEBRA DE LINHA
/* * * * CONFIGURATION END * * * * */
//Connect to the host on the specified port
$smtpConnect = fsockopen($smtpServer, $port, $errno, $errstr, $timeout);
$smtpResponse = fgets($smtpConnect, 515);
if(empty($smtpConnect)) {
$output = "Failed to connect: $smtpResponse";
return $output;
} else {
$logArray['connection'] = "Connected: $smtpResponse";
}
//Request Auth Login
fputs($smtpConnect,"AUTH LOGIN" . $newLine);
$smtpResponse = fgets($smtpConnect, 515);
$logArray['authrequest'] = "$smtpResponse";
//Send username
fputs($smtpConnect, base64_encode($username) . $newLine);
$smtpResponse = fgets($smtpConnect, 515);
$logArray['authusername'] = "$smtpResponse";
//Send password
fputs($smtpConnect, base64_encode($password) . $newLine);
$smtpResponse = fgets($smtpConnect, 515);
$logArray['authpassword'] = "$smtpResponse";
//Say Hello to SMTP
fputs($smtpConnect, "HELO $localhost" . $newLine);
$smtpResponse = fgets($smtpConnect, 515);
$logArray['heloresponse'] = "$smtpResponse";
//Email From
fputs($smtpConnect, "MAIL FROM: $from" . $newLine);
$smtpResponse = fgets($smtpConnect, 515);
$logArray['mailfromresponse'] = "$smtpResponse";
//Email To
fputs($smtpConnect, "RCPT TO: $to" . $newLine);
$smtpResponse = fgets($smtpConnect, 515);
$logArray['mailtoresponse'] = "$smtpResponse";
//The Email
fputs($smtpConnect, "DATA" . $newLine);
$smtpResponse = fgets($smtpConnect, 515);
$logArray['data1response'] = "$smtpResponse";
//Construct Headers
$headers = "MIME-Version: 1.0" . $newLine;
$headers .= "Content-type: text/html; charset=iso-8859-1" . $newLine;
$headers .= "From: $namefrom" . $newLine;
fputs($smtpConnect, "To: $to\nSubject: $subject\n$headers\n\n$message\n.\n");
$smtpResponse = fgets($smtpConnect, 515);
$logArray['data2response'] = "$smtpResponse";
// Say Bye to SMTP
fputs($smtpConnect,"QUIT" . $newLine);
$smtpResponse = fgets($smtpConnect, 515);
$logArray['quitresponse'] = "$smtpResponse";
}
?>
Edição feita por: mestre fyoda, 24/01/2006, 15:23.
0 membro(s), 1 visitante(s) e 0 membros anônimo(s)