Ciao ho creato un form in html e ho collegato una pagina php; eccola qui:
Quando provo il sito (naturalmente su un server) mi dice: Message was not sent.Mailer error: SMTP Error: Could not connect to SMTP host.
Che errore ho commesso ?
Il funzionamento del sito è: scrivo il testo: speech e scrivo l'indirizzo email e clicco invia e il testo viene inviato alla casella email
Come mai non funziona ?
PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento senza titolo</title>
</head>
<body>
<?php
$speech=$_POST["speech"];
$destinatario=$_POST["email"];
$oggetto="Soundy";
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "smtp.gmail.com"; // SMTP server
$mail->Username = "[email protected]"; // SMTP username
$mail->Password = "password"; // SMTP password
$mail->SMTPAuth = true;//Abilito l'autenticazione SMTP
$mail->Port = 465;
$mail->From = "[email protected]";
$mail->AddAddress("$destinatario");
$mail->Subject = "Soundy";
$mail->Body = "$speech";
$mail->WordWrap = 50;
if(!$mail->Send()) {
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent.';
}
?>
</body>
</html>
Quando provo il sito (naturalmente su un server) mi dice: Message was not sent.Mailer error: SMTP Error: Could not connect to SMTP host.
Che errore ho commesso ?
Il funzionamento del sito è: scrivo il testo: speech e scrivo l'indirizzo email e clicco invia e il testo viene inviato alla casella email
Come mai non funziona ?
Ultima modifica di un moderatore: