problems sending HTML mails

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mzfp2
Forum Contributor
Posts: 137
Joined: Mon Nov 11, 2002 9:44 am
Location: UK
Contact:

problems sending HTML mails

Post by mzfp2 »

Hi

Ive used the following code from another post to send HTML emails

Code: Select all

<?php 
$message = "<h1>Hello world!<h1>"; 
$to      = "empfaenger@system.de"; 
$subject = "Betrefftext"; 
$xtra    = "From: ab@sender.de (Ab Sender)\r\n"; 
$xtra   .= "Content-Type: text/html\r\nContent-Transfer-Encoding: 8bit\r\n"; 
$xtra   .= "X-Mailer: PHP ". phpversion(); 

mail($to, 
     $subject, 
     $message, 
     $xtra); 

?>

It works perfectly fine, except when i receive the email myself, the HTML output contains the following line at the top of the email

Content-Transfer-Encoding: 8bit X-Mailer: PHP 4.1.2

how do I get rid of it?!
User avatar
markl999
DevNet Resident
Posts: 1972
Joined: Thu Oct 16, 2003 5:49 pm
Location: Manchester (UK)

Post by markl999 »

Er..just don't add it to the email? i.e

Code: Select all

$xtra    = "From: ab@sender.de (Ab Sender)\r\n";
$xtra    .= "Content-Type: text/html\r\n";
//$xtra   .= "Content-Transfer-Encoding: 8bit\r\n"; 
//$xtra   .= "X-Mailer: PHP ". phpversion();
??
mzfp2
Forum Contributor
Posts: 137
Joined: Mon Nov 11, 2002 9:44 am
Location: UK
Contact:

Post by mzfp2 »

yeah i shouldve tried that, but i thought its probably important part of the header or something :oops:
Post Reply