Hola,
Tengo un problema…
Cambie de un servidor para otro y la librería SwiftMailer me dejo de funcionar.
Ahora tengo un Pack Web Pro+ de Amen.es…
Estoy intentando de todo, pero no envía mail.
He preguntado a la asistencia de Amen.es se era permitido enviar mail con una conexión via SMTP (puerto: 25) y me han dicho que si. Pero nada… No envía mails.
Sin autentificación:
<<<SCRIPT>>>
<?php
require_once './Swift/Swift.php';
require_once './Swift/Connection/SMTP.php';
//Limits the maximum execution time
set_time_limit(120);
//$swift = new Swift(new Swift_Connection_SMTP('smtp.jazztel.es'));
$swift = new Swift(new Swift_Connection_SMTP('80.168.45.11'));
/*========== PLAIN PART ==========*/
$plain_part = "Testing...";
$swift->addPart($plain_part);
/*================================*/
/*========== HTML PART ==========*/
$html_part = '<b>Testing...</b>';
$swift->addPart($html_part, 'text/html');
/*===============================*/
/*========== RECIPIENTS ==========*/
$recipients = array(
array('Mi Nombre', '[email protected]')
);
/*================================*/
/*========== SUBJECT ==========*/
$subject = 'Newsletter...';
/*================================*/
/*========== SEND MAIL ==========*/
if ($swift->isConnected())
{
$swift->send($recipients, '"Server" <[email protected]>', $subject);
$swift->close();
}
/*===============================*/
/*========== ERRORS ==========*/
if ($swift->hasFailed())
{
$send_mail = 'false';
}else{
$send_mail = 'true';
}
/*============================*/
echo "STATUS: $send_mail<br><br><br>";
echo "LOG: <pre>" . print_r($swift->transactions, 1) . "</pre>";
?>
<<<LOGS>>>
STATUS: true
LOG:
Array
(
[0] => Array
(
[command] =>
[time] => 0.74774100 1169834308
[response] => 220 cgi06-ch.uk.clara.net ESMTP Exim 4.52(Clarahost) Fri, 26 Jan 2007 17:58:28 +0000
)
[1] => Array
(
[command] => EHLO site
[time] => 0.75098200 1169834308
[response] => 250-cgi06-ch.uk.clara.net Hello cgi06-ch.uk.clara.net [195.8.66.22]
250-SIZE 52428800
250-PIPELINING
250-AUTH EXTERNAL
250 HELP
)
[2] => Array
(
[command] => MAIL FROM:
[time] => 0.76235600 1169834308
[response] => 250 OK
)
[3] => Array
(
[command] => RCPT TO:
[time] => 0.76418600 1169834308
[response] => 550 Site not permitted to send mail
)
[4] => Array
(
[command] => RSET
[time] => 0.76682200 1169834308
[response] => 250 Reset OK
)
[5] => Array
(
[command] => QUIT
[time] => 0.76865200 1169834308
[response] => 221 cgi06-ch.uk.clara.net closing connection
)
)
Para enviar mail, por un cliente de mail, necesito autentificación e posiblemente esta aquí el error.
Pero con la librería SwiftMailer nunca tengo una autentificación valida do servidor.
Con autentificación:
<<<SCRIPT>>>
<?php
require_once './Swift/Swift.php';
require_once './Swift/Connection/SMTP.php';
//Limits the maximum execution time
set_time_limit(120);
//$swift = new Swift(new Swift_Connection_SMTP('smtp.jazztel.es'));
$swift = new Swift(new Swift_Connection_SMTP('80.168.45.11'));
if($swift->authenticate('[email protected]', 'password'))
{
echo "AUTH OK<br><br><br>";
}else{
echo "AUTH NOK<br><br><br>";
}
/*========== PLAIN PART ==========*/
$plain_part = "Testing...";
$swift->addPart($plain_part);
/*================================*/
/*========== HTML PART ==========*/
$html_part = '<b>Testing...</b>';
$swift->addPart($html_part, 'text/html');
/*===============================*/
/*========== RECIPIENTS ==========*/
$recipients = array(
array('Mi Nombre', '[email protected]')
);
/*================================*/
/*========== SUBJECT ==========*/
$subject = 'Newsletter...';
/*================================*/
/*========== SEND MAIL ==========*/
if ($swift->isConnected())
{
$swift->send($recipients, '"Server" <[email protected]>', $subject);
$swift->close();
}
/*===============================*/
/*========== ERRORS ==========*/
if ($swift->hasFailed())
{
$send_mail = 'false';
}else{
$send_mail = 'true';
}
/*============================*/
echo "STATUS: $send_mail<br><br><br>";
echo "LOG: <pre>" . print_r($swift->transactions, 1) . "</pre>";
?>
<<<LOGS>>>
AUTH NOK
STATUS: false
LOG:
Array
(
[0] => Array
(
[command] =>
[time] => 0.48769400 1169837705
[response] => 220 cgi01-ch.uk.clara.net ESMTP Exim 4.52(Clarahost) Fri, 26 Jan 2007 18:55:05 +0000
)
[1] => Array
(
[command] => EHLO site
[time] => 0.51899000 1169837705
[response] => 250-cgi01-ch.uk.clara.net Hello cgi01-ch.uk.clara.net [195.8.66.9]
250-SIZE 52428800
250-PIPELINING
250-AUTH EXTERNAL
250 HELP
)
)
)
Si… Se corta el proceso de envió…
Necesito la librería SwiftMailer para enviar newsletters y mails con dudas y preguntas desde mi site.
Necesito ayuda, estoy desesperado :oP
Gracias, Pardalito.