Forum Moderators: coopster

Message Too Old, No Replies

Mail...dun dun dun

html problem

         

WhosAWhata

3:33 am on Apr 12, 2004 (gmt 0)

10+ Year Member



i have code like this,
$message = '<html>
<body bgcolor=black text=white link=yellow alink=yellow vlink=yellow>
<center>
<h1>User Registered</h1>
<hr width=85% color=blue><table cols=2 border=1 bordercolor=navy>
<tr><td>User:</td><td>$username</td></tr><tr><td>Pass:</td> <td>$password</td></tr><tr><td>Name:</td><td>$first $last</td></tr><tr><td>email</td><td>$email</td></tr></table> </center></body></html>';
$headers = "From: Registration <postmaster@site.com>\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
@mail("New <webmaster@site.com>","New User Registration",$message,$headers);

it returns something similar to this,
it returns a message with the following body (as text hot as rendered html>

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

<html><body bgcolor=black text=white link=yellow alink=yellow vlink=yellow><center><h1>User Registered</h1><hr width=85% color=blue><table cols=2 border=1 bordercolor=navy><tr><td>User:</td><td>username</td></tr> <tr><td>Pass:</td><td>password</td></tr><tr><td>Name:</td><td>Me Here</td></tr><tr><td>email</td><td>email@domian.com</td></tr> </table></center></body></html>

WHAT AM I DOING WRONG?

[edited by: jatar_k at 9:35 pm (utc) on April 12, 2004]
[edit reason] fixed sidescroll [/edit]

henry0

11:51 am on Apr 12, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



is this a page with a " .PHP " extension
I have the feeling that as is it echoes all
instead of parsing it
could you try to:
within a .PHP page
built as a regular .HTML page
have set all your rows etc..
and then only do an <? include?> for each php segment

or did I missunderstood the question?
Henry

Edit: forgot <?> </end edit>

WhosAWhata

9:33 pm on Apr 12, 2004 (gmt 0)

10+ Year Member



I'm not quite sure what you mean
this is part of register.php
it sends the mail, but it is still in text format
ie: instead of a black background it SAYS <body bgcolor=black>

jatar_k

9:35 pm on Apr 12, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



you could also check the mail client it could be set to only receive in text

WhosAWhata

10:43 pm on Apr 12, 2004 (gmt 0)

10+ Year Member



no, i recieve html e-mail all the time
good suggestion though,
so it's not something with the code? i know i've used open source scripts on this server that sent propper html e-mails

WhosAWhata

9:19 pm on Apr 13, 2004 (gmt 0)

10+ Year Member



i suppose i'll just code it for a text based e-mail,

thanks for the thoughts

jatar_k

9:38 pm on Apr 13, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



I always just go with the "I hate email" mantra

try messing around with the headers and see what happens, I have a set that I use most of the time and they seem to work. They are, at least, the most reliable set I have found.

$from = "From: $fromemail\n";
$from .= "X-Sender: $fromemail\n";
$from .= "X-Mailer: PHP\n";
$from .= "X-Priority: 3\n";
$from .= "Return-Path: $fromemail\n";
$from .= "Reply-To: $fromemail\n";
$from .= "Content-type: text/html\n";

I don't always use use Content Type, depends on my mood. :)

Timotheos

10:03 pm on Apr 13, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I can't see anything wrong with it. Here's what I use that works for me. The only difference being I put the MIME and content type headers first.

$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=utf-8\r\n";
$headers .= "From: Me <me@example.com>\r\n";

WhosAWhata

11:27 pm on Apr 13, 2004 (gmt 0)

10+ Year Member



well your code works jatar_k,
thanks

Timotheos

11:42 pm on Apr 13, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have a sneaking suspicion that "\r\n" could be your culprit.

WhosAWhata

1:59 am on Apr 14, 2004 (gmt 0)

10+ Year Member



very well could be,
i was just taking the idea from php.net's examples