Posto anche il codice della form, in cui ho tagliato qualche campo rispetto all'originale, perchè non mi serviva:
<FORM method="POST" action="contact_sent.php" name="contact_frm">
<TABLE border=0>
<TR>
<TD>Your Name:
<INPUT type="text" name="name" size=48></TD>
<TR>
<TD>Your e-mail<FONT class=RequiredField>:*</FONT>
<INPUT type="text" name="email" size=48>
<FONT class=RequiredField> </FONT></TD>
</TR>
<TD>Phone number:
<INPUT type="text" name="phone" size=48></TD>
</TR>
<TR>
<TD valign=top>Message: *
<TEXTAREA name="text" cols=40 rows=10></TEXTAREA></TD>
</TR>
<TR>
<TD>
<INPUT type=image value="Send" src="../contact-send.gif" width="60" height="25"></TD>
</TR>
</TABLE>
</FORM>
Questo invece il codice del file contact_sent:
<?php
error_reporting(0);
include('contact_settings.php');
include('TemplateMailer.class.php');
$temp = new TemplateMailer();
function daj($msg) {
global $template_folder,$temp;
$temp->assign('errmsg',$msg);
$temp->preparemail($template_folder . 'contact_error.tpl.html');
die($temp->body);
}
$name = $_POST['name'];
$company = $_POST['company'];
$email = $_POST['email'];
if (trim($email) == "") { daj("Devi inserire il tuo indirizzo mail cosi ti possiamo contattare!"); }
$phone = $_POST['phone'];
$reason = $_POST['reason'];
$subj = $_POST['subject'];
$description = $_POST['text'];
if (trim($description) == "") { daj("Devi scrivere un messaggio!"); }
$temp->assign('name',$name);
$temp->assign('company',$company);
$temp->assign('email',$email);
$temp->assign('phone',$phone);
$temp->assign('reason',$reason);
$temp->assign('message',$description);
$temp->preparemail($template_folder . 'contact_mail.tpl.html');
$adresa = $reasons[$reason];
$sent = $temp->send($email,$adresa,$email_subject.' '.$subj,'');
if ($sent) {
$disya = basename($_SERVER['PHP_SELF']);
$disya = str_replace('.php','.tpl.html',$disya);
$temp->assign("template_file",$disya);
$temp->preparemail($template_folder . $disya);
echo $temp->body;
}
else { daj("C'è un problema con la spedizione della e-mail. Per favore prova più tardi!"); }
?>
![]()