Jump to content

PHP mail() function


JamesKoash

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/281960-php-mail-function/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.