Pear Mail.php doesn't show error messages !!
| From: | Adalberto | Date: | Fri, 04 Apr 2008 00:20:39 +0000 |
| Subject: | Pear Mail.php doesn't show error messages !! | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-28738@lists.php.net to get a copy of this message | ||
Hi, I will try to explain what happend because English is not my natural
language !!
I have this code :
<?php
require_once "Mail.php";
if($_POST[sub_login]=='Enviar')
{
$from = "user@XXXXX"; // Remetente da mensagem
$to = "user@domain.com"; // Destinatário da mensagem
$subject = "Testando Código PHP";
$headers = array('From' => $from,'To' => $to,'Subject'
=> $subject);
$body = "Olá!\n\n Este é um teste de envio de email através de SMTP!";
$host = "ssl://smtp.gmail.com"; // no meu caso, utilizei o smtp do
Gmail
$port = 465;
$auth = "true";
$debug= "true";
$username = "@gmail.com"; // no caso do gmail, utiliza-se o que vem
antes da arroba.
$password = "yyyyyy"; // sua senha do provedor
$params = array('host' => $host,'port' => $port ,'auth'
=>
$auth,'debug' => $debug ,'username' => $username,'password'$
$smtp = Mail::factory('smtp',$params);
$mail = $smtp->send($to, $headers, $body);
}
?>
<html>
<body>
<?php
if(PEAR::isError($mail))
{
echo("<p>" . $mail->getMessage() . "</p>");
}
else
{
echo("<p>Email enviado com sucesso!!</p>");
}
?>
.... Here continues the code html inside file .php !!!
----------------------------------
So the problem is :
When I pass the parameter $host ="ssl://smtp.gmail.com"; I get the error :
DEBUG: Recv: 220 mx.google.com ESMTP i19sm12798696wxd.33 DEBUG: Send: EHLO
localhost DEBUG: Recv: 250-mx.google.com at your service, [200.148.44.52]
DEBUG: Recv: 250-SIZE 28311552 DEBUG: Recv: 250-8BITMIME DEBUG: Recv:
250-AUTH LOGIN PLAIN DEBUG: Recv: 250 ENHANCEDSTATUSCODES
unable to authenticate to smtp server
But if I pass the parameter $host ="smtp.gmail.com" , just like this, my
browser doesn't return error and it's
trying and tryin to load the page but nothing is returned !!
Anyone could help me with this problem ??
Some information about my packages :
obiwan:/# dpkg -l php-*
Desejado=U=Desconhecido/Instalar/Remover/aPagar/H=Manter
| status=Não/Instalado/arquiv.-Config./U=Descomp./Falhou-config/H=semi-inst.
|/ Erro?=(nenhum)/H=Mantido/precisa-Reinst./X=os dois problemas
(status,Erro: maiúsculas=ruim)
||/ Nome Versão Descrição
+++-=========================-=========================-==================================================================
un php-auth-sasl <nenhuma> (nenhuma descrição
disponível)
ii php-mail 1.1.6-2 PHP PEAR
module for sending email
ii php-net-smtp 1.2.6-2 PHP PEAR
module implementing SMTP protocol
ii php-net-socket 1.0.6-2 PHP PEAR
Network Socket Interface module
ii php-pear 5.2.0-8+etch10 PEAR - PHP
Extension and Application Repository
obiwan:/#
Thanks in advanced.
Adalberto.
--
View this message in context: http://www.nabble.com/Pear--Mail.php-doesn%27t-show-error-messages-%21%21-tp16476118p16476118.html
Sent from the Pear - General mailing list archive at Nabble.com.