Bonjour,
J'essaye d’envoyer un mail via php
Cela fonctionne en partie je reçois bien un mail mais les CC et From ne fonctionnent pas les headers donc
J"ai parcouru exemple et forum mais mon code semble correct
Merci pour votre aide
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
<?php
if(isset($_POST["submit"])){
// Checking For Blank Fields..
if($_POST["vname"]==""||$_POST["vemail"]==""||$_POST["sub"]==""||$_POST["msg"]==""){
echo "Fill All Fields..";
}else{
// Check if the "Sender's Email" input field is filled out
//$email=$_POST['vemail'];
 
// Sanitize E-mail Address
//$email =filter_var($email, FILTER_SANITIZE_EMAIL);
// Validate E-mail Address
//$email= filter_var($email, FILTER_VALIDATE_EMAIL);
$email=htmlspecialchars($_POST["vemail"]);
$message = htmlspecialchars($_POST["msg"]);
if (!$email){
echo "Invalid Sender's Email";
}
else{
$subject = $_POST['sub'];
$headers  = 'MIME-Version: 1.0'."\n"; // Version MIME
$headers .= 'Reply-To: '.$email."\n";
$headers .= 'From:'.$email. "\n"; // Sender's Email
$headers .= 'Cc:'.$email. "\n"; // Carbon copy to Sender
echo $headers;
// Message lines should not exceed 70 characters (PHP rule), so wrap it
$message = wordwrap($message, 70);
// Send Mail By PHP Mail Function
mail("moi@gmail.com",$subject,$message,$headers);
echo "Your mail has been sent successfuly ! Thank you for your feedback";