array(
'text' => 'Nom du contact',
'val' => $_POST['name']
),
1 => array(
'text' => 'Telephone',
'val' => $_POST['phone']
),
2 => array(
'text' => 'Adresse mail',
'val' => $_POST['email']
),
3 => array(
'text' => 'Adresse du futur chantier',
'val' => $_POST['adressechantier']
),
4 => array(
'text' => 'Ville du futur chantier',
'val' => $_POST['ville']
),
5 => array(
'text' => 'Message',
'val' => $_POST['message']
)
);
$message = "";
foreach($fields as $field) {
$message .= $field['text'].": " . htmlspecialchars($field['val'], ENT_QUOTES) . "
\n";
}
$mail = new PHPMailer;
//JAT $mail->IsSMTP();
$mail->isQmail();
// Debug Mode
//$mail->SMTPDebug = 1;
// Step 4 - If you don't receive the email, try to configure the parameters below:
//$mail->Host = 'mail.yourserver.com'; // Specify main and backup server
//$mail->SMTPAuth = true; // Enable SMTP authentication
//$mail->Username = 'username'; // SMTP username
//$mail->Password = 'secret'; // SMTP password
//$mail->SMTPSecure = 'tls'; // Enable encryption, 'ssl' also accepted
$mail->From = $email;
$mail->FromName = $_POST['name'];
$mail->AddAddress($to);
$mail->AddReplyTo($email, $name);
$mail->IsHTML(true);
$mail->CharSet = 'UTF-8';
$mail->Subject = $subject;
$mail->Body = $message;
// Step 5 - If you don't want to attach any files, remove that code below
if (isset($_FILES['attachment']) && $_FILES['attachment']['error'] == UPLOAD_ERR_OK) {
$mail->AddAttachment($_FILES['attachment']['tmp_name'], $_FILES['attachment']['name']);
}
if($mail->Send()) {
$arrResult = array('response'=> 'success');
} else {
$arrResult = array('response'=> 'error', 'error'=> $mail->ErrorInfo);
}
} else {
$arrResult['response'] = 'captchaError';
}
}
?>
Prenez le temps de rédiger votre message en indiquant le plus de détails possible. Il sera lu attentivement.
Il ne sera répondu qu'aux formulaires comportant un numéro de téléphone ou un email valide.