1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
public function mail(){
$sujet = "";
$destinataire = "";
$message = "";
if (isset($_POST['sujet'])) {
$sujet = htmlspecialchars($_POST['sujet']);
}
if (isset($_POST['destinataire'])) {
$destinataire = htmlspecialchars($_POST['destinataire']);
}
if (isset($_POST['message'])) {
$message = htmlspecialchars($_POST['message']);
}
$expediteur = 'contact@andre-ani.fr';
$headers = 'MIME-Version: 1.0' . "\n";
$headers .= "Content-type: text/plain; charset=utf-8\n";
$headers .= 'Reply-To: ' . $expediteur . "\n";
$headers .= 'From: "Patrice Andreani"<' . $expediteur . '>' . "\n";
$headers .= "Cc : contact@andre-ani.fr\n";
$headers .= 'Delivered-to: ' . $destinataire . "\n";
$headers .= "X-Priority : 3\n";
$headers .= "Content-Transfer-Encoding: 8bit\n";
mail($destinataire, $sujet, $message, $headers);
return back()
->with('success','Mail envoyé.');
} |