Page 1 of 1
how can i send HTM emails?
Posted: Tue Sep 30, 2003 12:02 pm
by webfinearts
I tried to send HTML emails including following lines in the header:
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
But what i receive is a plain text of the email (including the html code).
If is possible please just post also a working email class. I will appreciate that a lot

.
Posted: Tue Sep 30, 2003 1:21 pm
by philippgerard
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);
?>
Posted: Tue Sep 30, 2003 2:01 pm
by webfinearts
Can you explain me that encoding line?
Posted: Tue Sep 30, 2003 2:05 pm
by webfinearts
Look what he gave me:
Content-Type: text/html
Content-Transfer-Encoding: 8bit
From: Birthday Reminder <
birthday@example.com>
<html>
<head>
and here the html code
Posted: Tue Sep 30, 2003 2:12 pm
by webfinearts
Is displayng me every time this line:
Content-Transfer-Encoding: 8bit X-Mailer: PHP 4.2.2
My problem is that i do not know what's happening

. Damn i'm a great newbie
Posted: Wed Oct 01, 2003 7:24 am
by Derfel Cadarn
ehm, i suppose you didn't switch off the ability to receive e-mails in HTML-format in your mail-programm, did you?
That would be
my newbie-mistake !
Edit: The script from philippgerard seems to work for me.
Posted: Wed Oct 01, 2003 8:50 am
by philippgerard
sure it does
I only post wrong code when asking you guzs to find
my bugs
guess your mailprog sucks. allow it to display html should work.
Posted: Wed Oct 01, 2003 9:25 am
by webfinearts
hm no
Because eerything seems to be ok now, only that line.
The funny thing is that if i'm deleting it the next line above that is displayed.
Posted: Wed Oct 01, 2003 9:48 am
by jayr517
The funny thing is that if i'm deleting it the next line above that is displayed.
Can you post the code you're having a problem with? I know philip posted the code you're using, but sometimes a syntax or logic error can sneak in while you're formatting, modifying, deleting etc, etc, etc...