Salve ragazzi ho dei problemi con phpmailer
io dovrei inviare una mail automatica di ringraziamento dopo che l'utente ha riempito e inviato un form nel sito,
ora io ho fatto cosi:
Questo è il form
Codice PHP:
<div class="class_div_mail">
<form id="form1" name="prova_gratis" method="POST" action="PHPMailer/config_mail.php">
<label for="nome">Nome</label>
<input type="text" name="nome" id="nome"/>
<label for="cognome">
Cognome</label>
<input type="text" name="cognome" id="cognome" />
<label for="email">
Email</label>
<input type="text" name="email" id="email" />
<label for="telefono"> Telefono</label>
<input type="text" name="telefono" id="telefono" />
<label for="attivita">
Attività
</label>
<select name="attivita" id="attivita">
<option value="" selected="selected">Scegli.......</option>
<option value="Stretching">Stretching</option>
<option value="Total Body">Total Body</option>
<option value="Soft Pilates">Soft Pilates</option>
<option value="Tone Pilates">Tone Pilates</option>
<option value="Pilates">Pilates</option>
<option value="Gym Soft">Gym Soft</option>
<option value="Yoga - (De Rose)">Yoga - (De Rose)</option>
<option value="Ginnastica Posturale">Ginnastica Posturale</option>
<option value="Spinning">Spinning</option>
<option value="Tonificazione">Tonificazione</option>
<option value="Interval Training">Interval Training</option>
<option value="Total Work Out">Total Work Out</option>
<option value="Body Sculpt">Body Sculpt</option>
<option value="Total Body">Total Body</option>
<option value="Step Coreografico">Step Coreografico</option>
<option value="Corpo Libero">Corpo Libero</option>
<option value="G.a.g.">G.a.g.</option>
</select>
<input type="submit" name="Submit" value="Invia!" />
<input type="reset" name="Submit2" value="Cancella" />
<input type="hidden" name="MM_insert" value="prova_gratis" />
</form>
</div>
e Questa è la mia pgina di config
Codice PHP:
<?php require_once('../../Connections/fitnesscenter.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($database_fitnesscenter, $fitnesscenter);
$query_Rs_mail = "SELECT nome, cognome, email, attivita FROM prova_gratis ORDER BY id DESC";
$Rs_mail = mysql_query($query_Rs_mail, $fitnesscenter) or die(mysql_error());
$row_Rs_mail = mysql_fetch_assoc($Rs_mail);
$totalRows_Rs_mail = mysql_num_rows($Rs_mail);
$nome = $_POST['nome'];
$cognome = $_POST['cognome'];
$telefono = $_POST['telefono'];
$email = $_POST['email'];
$attivita = $_POST['attivita'];
require_once 'class.phpmailer.php';
$mail = new PHPMailer();
// set mailer to use SMTP
$mail->Host = ""; // specify main and backup server
$mail->Username = ""; // SMTP username
$mail->Password = ""; // SMTP password
$mail->From = 'info@mdstudioweb.com';
$mail->FromName = 'info@mdstudioweb.com';
$mail->SetLanguage("it", "language/phpmailer.lang-it.php");
$mail->AddAddress("info@mdstudioweb.com", "nome");
//$mail->AddAddress("ellen@example.com"); // name is optional
$mail->AddReplyTo("$email", "Ciao $nome $cognome /n
Hai richiesto una prova gratuita per l'attività $attivita ");
$mail->WordWrap = 50; // set word wrap to 50 characters
//$mail->AddAttachment("/var/tmp/file.tar.gz"); / add attachments
//$mail->AddAttachment("/tmp/image.jpg", "new.jpg"); // optional name
$mail->IsHTML(true);// set email format to HTML
$mail->Subject = "Here is the subject";
$mail->Body = "This is the HTML message body [b]in вакпрнолгнкг5глгоьктртунл![/b]";
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";
if(!$mail->Send())
{
echo "Message could not be sent.
";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
mysql_free_result($Rs_mail);
?>
però ne mi invia l'email nè mi risponde automaticamente qualcuno può aiutarmi