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

Need help using the mail function

$
0
0

Hey,

 

 I am learning on how to use the mail function in PHP and have wrote one in PHP. Every time I try to execute it, I get an the message that says error. I have scanned through my code and everything seems to correct. Do you guys have any suggestions? Thanks

<?php

	$to = "nobody@somedomain.com";

	$subject = "Mail Test at ".strftime("%T", time());

	$message = "This is a test.";
	// Optional: Wrap lines for old email programs
	// wrap at 70/72/75/78
	$message = wordwrap($message,70);
	
	$from = "somebody@somedomain.com";
	$headers = "From: {$from}";
	
	$result = mail($to, $subject, $message, $headers);
	echo $result ? 'Sent' : 'Error'; // I get an "Error" every time I run this page
  
?>

Viewing all articles
Browse latest Browse all 13200

Trending Articles