e-mails in HTML format


#1

Why I can’t send emails in html?
I’m using mail()

Thanks!


#2

Probably because you did not indicate Content-Type: text/html in the headers.


#3

true!

Thanks friend! :D


#4

Any chance I could see an example of how this is done?


#5

http://us4.php.net/manual/en/function.mail.php


#6

Here it is:
[php]
$email="example@example.com"; // Email recipient
$body="

        <h1> My HTML Message goes Here</h1>
";

mail("$email", “Email Subject”, “$body”, “Content-type: text/html;”);
echo “Message sent to $email”;
[/php]


#7

Make sure you are using a more recent PHP release. I think anything over 4.3.3 will work, but 4.3.3 and below were giving me a LOT of funky dropped characters (I think in the bug list it said every 1024 chars.) If you are using HTML email, then you’ll have a lot of problems with tables and such. I just went up to 4.3.7 and the same code has no lost character problems - the email looks great.


#8

Hm… I never had that problem…


#9

Apparently it’s a Windows/HTML thing. I’m using Apache2 on a windows machine and it happened all the time - probably 2/3 of all my outgoing emails.


#10

I have
IIS 5.1 and IIS 6.0 and no problems,

probably you have it because Apach is interfearing with some internal procecess and when email is sent it sending let say 5600FFx00 and other APP is using that derictive


#11

Checkout:
http://bugs.php.net/bug.php?id=25333


#12

ok…
maybe i didn’t have that because I was using MS Exchange 2000 (and now 2003)?


#13

Thanks for this, but here’s a problem I’m having:

”.$AddLine1."

"

I need to get the ‘3’ into quotes. How do I do this?


#14

Ok then use ASCII codes:

&quot;3&quot;

This will give you “3”

“=”


#15

I tried this

"n".

and I got this in my final source

I think I’m missing something fundamental. Any ideas?


#16

it seams that HTML Processor ignores the ASCII derectives within the tags… I can’t think of different solution, but there may be a way around.

Why do you need to use quotes? if only for a HTML tag you may ignore them or use single quote ( [’] instead of ["])