Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP Mail header (hotmail / exchange) problems 1

Status
Not open for further replies.

draigGoch

Programmer
Feb 10, 2005
166
GB
Can someone please help me! I am going insane......
I am trying to execute the mail() function on a windows server, and when I use the simple version:

Code:
mail("address@domain.com","SUBJECT","MESSAGE");

there are no problems, but the moment that I use the additional headers parameter it doesn't work...... here is my code:

Code:
<?php

// subject
$subject = 'Testing mail function';

// message
$message = '
<html>
<head>
  <title>HTML TEST</title>
</head>
<body>
  <p>HTML TEST!</p>
</body>
</html>
';

$delimeter = "\r\n";
// To send HTML mail, the Content-type header must be set
$headers = "MIME-Version: 1.0".$delimeter;
$headers .= "Content-type: text/html; charset=utf-8".$delimeter;
$headers .= "From: $from".$delimeter;
$headers .= "Reply-To: $from".$delimeter;
$headers .= "Cc: $cc".$delimeter; 

// Mail it
if (mail($to, $subject, $message, $headers)) {
	echo "E-mail sent.";
} else {
	echo "ERROR! Can't send e-mail.";
}

?>

By the way the "\n" or "\n\r" issue is not to blame - as I have tried both......

Please help!

A computer always does what you tell it to, but rarely does what you want it to.....
 
you might want to take some guidance from the forum's FAQ's

faq434-2681

 
Thanks - I searched earlier but didn't find this page!

A computer always does what you tell it to, but rarely does what you want it to.....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top