Quantcast
Channel: PHP Freaks: PHP Help
Viewing all articles
Browse latest Browse all 13200

PHP mail() function

$
0
0

I've built a survey which uses sessions to store user input. Rather than putting this into an SQL database, I've decided to use PHP to email the data as the information isn't private or confidential. Here is my code, following ($_SERVER['REQUEST_METHOD'] == 'POST'):

	$to = "xyz";
$subject = "Survey Response";
$message = "Test";
$from = "xyz";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);

session_destroy();
			
		header('Location: page_6.php');
		exit;

'xyz' is obviously where a valid email address needs to go. However, even when I've tried it with a valid email address, nothing seems to be sending. Can someone tell me what I've done wrong?

 

I also tried $message = print_r($_SESSION); but that didn't work either.

 

Thanks


Viewing all articles
Browse latest Browse all 13200

Trending Articles