Ciao, scusa il ritardo ma ho visto ora la tua risposta:
Allora ho visto adesso che il problema è l'invio a gmail e quindi l'autenticazione.
Prova a impostare il tutto così e fammi sapere cosa ti dice:
codice:
$mail = new PHPMailer(); // create a new object
$mail->IsSMTP(); // enable SMTP
$mail->SMTPDebug = 0; // debugging: 1 = errori e messaggi, 2 = solo messaggi
$mail->SMTPAuth = true; // abilita autenticazione
$mail->SMTPSecure = 'ssl'; // Autenticazione con ssl <--- RICHIESTO DA GMAIL
$mail->Host = 'smtp.gmail.com';
$mail->Port = 465;
....
tutte le altre tue impostazioni ed indirizzi
if(!$mail->Send()) {
$error = 'Mail error: '.$mail->ErrorInfo;
return false;
} else {
$error = 'Message sent!';
return true;
}