Jump to content

including the right headers in an email script


dazzclub

Recommended Posts

I've been doing php email scripts on and of, but not paying that much attention. So now i going back and writing (attempting to) the email.php script, making it cleaner and trying to make it a better experience for the email applications to understand.

 

I have set up my email like this so far;

 

--------------------------

$sendTo = " myemail";

$subject = "test";

 

//set up headers

$headers  = "From: $EmailFrom \n";

$headers .= "$forename $surname \n";

$headers .= "Reply-To:myeail \r\n";

$headers .= "MIME-Version: 1.0\n";

$headers .= "Content-type: text/html; charset=iso-8859-1\n";

$message =" testing"

 

 

mail($sendTo, $subject, $message, $headers);

--------------------------

 

Now when i test this form, some of the headers i set up are included in the body, like this

 

darren azzopardi

Reply-To: my email

MIME-Version: 1.0

Content-type: text/html; charset=iso-8859-1

 

 

test

 

 

Have i used the wrong headers???

 

 

regards

Darren

try this..

<?php
$sendTo = "[email protected]";
$subject = "test";

//set up headers
$headers  = "From: Name LastName<[email protected]> \r\n";
$headers .= "Reply-To:[email protected] \r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$message =" testing";


mail($sendTo, $subject, $message, $headers);
?>

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.