Salve ho un problema a mandare le mail in html.... non me le manda (a due indirizzi uno gmail e l'altro libero) Il codice vi sembra corretto?
Codice PHP:
<?php
include 'header.php';
header('Content-type: application/json');
$email = mysql_real_escape_string($_POST['PreReg_Email']);
$pwd = mysql_real_escape_string($_POST['PreReg_Password']);
$com_code = md5(uniqid(rand()));
// Codifica
$enc_email = fnEncrypt($email,$key);
$enc_pwd = fnEncrypt($pwd,$key);
//CONTROLLA SE C'E' GIA' UN UTENTE REGISTRATO.
$sql = "SELECT `id` FROM `utenti` WHERE email='$enc_email'";
$result = mysqli_query($con,$sql) or die(mysql_error($con));
if (mysqli_num_rows($result) > 0) { //L'utente è presente nel database quindi interrompi la registrazione.
$response = true;
die(json_encode($response));
exit;
}
else
{
//Crea nel database i dati principali dell'account.
$sqlinsert="INSERT INTO $dbname.`utenti` (
`id` ,
`email` ,
`password`,
`com_code`
)
VALUES (NULL, '$enc_email', '$enc_pwd', '$com_code');";
$result = mysqli_query($con,$sqlinsert) or die(mysqli_error($con));
//Invia la mail di conferma registrazione
if ($result)
{
//______________________________________________________________________
$to = $email;
$subject = "Conferma registrazione";
$headers = "From: Miosito\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$headers .= "X-Mailer: PHP/" . phpversion();
$message = "
<html>
<body>
<div style='border: thin solid #ACC7EE; font-size: large; -webkit-box-shadow: 1px 1px 0px 3px #CCCCCC; box-shadow: 1px 1px 0px 3px #CCCCCC; position: relative; text-align: center;'>
<p><img style='position: absolute; top: 4px; left: 4px;' src='http://' width='300' height='132' /></p>
<p align='center'>Conferma avvenuta registrazione: <br>
<i>(Non rispondere a questo messaggio generato automaticamente)</i></p>
<p align='center'> </p>
<p align='center'>Benvenuto, le tue credenziali di accesso al portale sono: </p>
<table style='margin:0 auto;'>
<tr>
<td>Username:</td>
<td><strong>'.$email.'</strong></td>
</tr>
<tr>
<td>Password:</td>
<td><strong>'.$pwd.'</strong></td>
</tr>
</table>
<p> </p>
<p>Si prega di attivare l'account facendo click sul seguente link:</p>
<p><a></a></p>
</div>
</body>
</html>
";
//________________________________________________
if(mail($to,$subject,$messaggio,$header)!= true)
{
exit;
}
}
$response = false;
die(json_encode($response));
}// fine di else
?>