Ho un problema con l'utilizzo di phpmailer.
Mi restituisce l'errore "The following From address failed: user@dominio.com"
Questo è il codice del form:
Codice PHP:
<form action="formmail.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="destinatario" value="info@xx.it" />
<input type="hidden" name="oggetto" value="Messaggio dal sito xx.it" />
<table style="background-color: transparent" width="441" height="268" border="0" align="center" cellpadding="5" cellspacing="0">
<tr>
<td align="right">[b] Nome e Cognome:[/b]</td>
<td align="left"><input name="mittente" type="text" size="42" /></td>
</tr>
<tr>
<td align="right">[b]Email:[/b]</td>
<td align="left"><input name="email" type="text" size="42" /></td>
</tr>
<tr>
<td height="107" align="right">[b]Messaggio:[/b]</td>
<td align="left"><textarea name="messaggio" cols="33" rows="6"></textarea></td>
</tr>
<tr>
<td height="57" colspan="2"><input type="submit" value="Invia" /></td>
</tr>
</table>
</form>
Questo è formmail.php
Codice PHP:
require "phpmailer/class.phpmailer.php";
$messaggio = new PHPmailer();
$messaggio->IsSMTP();
$messaggio->Host='smtp.xx.it';
$messaggio->From=$_POST['email'];
$messaggio->AddAddress($_POST['destinatario']);
$messaggio->AddReplyTo($_POST['email']);
$messaggio->Subject=$_POST['oggetto'];
$messaggio->Body=$_POST['messaggio'];
if(!$messaggio->Send()){
echo $messaggio->ErrorInfo;
}else{
header("Location: inviook.php");
}
$messaggio->SmtpClose();
unset($messaggio);
?>
Help! Non riesco a venirne fuori!