Salve a tutti,
ho guardato i post attinenti questo problema esistenti nel forum, ma nessuna delle soluzioni
indicate ha risolto il mio problema.
Probabilmente � un problema legato alla configurazione del mio server locale :
EASY PHP 1.6.1.1 - PHP 5.6.19.
Questo e' il pezzo di PHP.ini che credo sia d'interesse :
[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = localhost
; http://php.net/smtp-port
smtp_port = 25
Ho provato utilizzando un sorgente fornito con la libreria modificando solo i parametri
delle email ma ricevo sempre lo stesso errore :
SERVER -> CLIENT: 220 smtp.gmail.com ESMTP y126sm63055wmg.29 - gsmtp
CLIENT -> SERVER: EHLO localhost
SERVER -> CLIENT: 250-smtp.gmail.com at your service, [5.170.10.21]250-SIZE 35882577250-8BITMIME250-STARTTLS250-ENHANCEDSTATUSCODES250-PIPELINING250 SMTPUTF8
CLIENT -> SERVER: STARTTLS
SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
SMTP Error: Could not connect to SMTP host.
CLIENT -> SERVER: QUIT
Questo e' il sorgente :
<php>
date_default_timezone_set('Etc/UTC');
require '../PHPMailerAutoload.php';
$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPDebug = 2;
$mail->Debugoutput = 'html';
$mail->Host = gethostbyname('smtp.gmail.com');
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->SMTPAuth = true;
$mail->Username = "mark.xxxxxxx@gmail.com";
$mail->Password = "xxxxxxxxxx";
$mail->setFrom('mark.xxxxxxxx@gmail.com', 'First Last');
$mail->addReplyTo('mauro.xxxxxxxx@libero.it', 'First Last');
$mail->addAddress('sixxxxxxxx@gmail.com', 'John Doe');
$mail->Subject = 'PHPMailer GMail SMTP test';
$mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
$mail->AltBody = 'This is a plain-text message body';
// questo l'ho bloccato per la prova
// $mail->addAttachment('images/phpmailer_mini.png');
//
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>
... ribadisco che il codice e' esattamente quello fornito con la libreria di mio non c'e' nulla
... ecco perche' e' strano che non funzioni...