Piotr Ciszewski
Piotr Ciszewski

Reputation: 1801

Email grabbed from the online form is not displayed as a SENDER in incoming message (PHP code issue?)

I have a problem with my php. I'm sure it was working it the past, but sth is wrong now. The problem is - that this code suppose to send an email msg using form data and it should come from 'email', so whatever will be typed in field 'email' should appear as a sender of the incoming message. It doesn't display it properly, so when I use REPLY button in my outlook it can't send an email, because it can't reply to nothing. What could be a problem? is this code ok?

code is here:

$adresdo = "[email protected]";
$temat = "Quote from the website";
$zawartosc = "Name: ".$_POST['name']."\n"
           ."Email: ".$_POST['email']."\n"
           ."Telephone: ".$_POST['tel']."\n"
           ."Date: ".$_POST['date']."\n";

if(!$_POST['name'] || !$_POST['tel'] || !$_POST['date']){
 header("Location: ../quote.html");
 exit;
}
 if(mail($adresdo, $temat, $zawartosc, 'From: Contact <'.$email.'>')){
header("Location: ../msg_sent.html"); 
}

Thanks for any help in advance. P.

Upvotes: 0

Views: 81

Answers (2)

user1329212
user1329212

Reputation:

When you're sending mail you should use headers information. (You can check here : php email headers)

Your question is related with this topic.

Upvotes: 1

Paul Dessert
Paul Dessert

Reputation: 6389

$email isn't defined. You need to assign it to something.

$email = $_POST['email'];

Upvotes: 3

Related Questions