By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,964 Members | 1,318 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,964 IT Pros & Developers. It's quick & easy.

HTML email using PHP problem (Receive html tags)

P: n/a
Hi all,

When I send the html email, the only thing I receive is the tags (the
html codes basically). I want to be able to see the email like a html
page, what is wrong with my code? Here is a copy paste of it.

$HTML = "</html><body><img src='http://www.somewebsite.com/
someimage.jpg'></body></html>";

$headers = "From: $from\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$boundary = uniqid("HTMLDEMO");
// Now we attach the HTML version

$headers .= "--$boundary\r\n".
"Content-Type: text/html; charset=ISO-8859-1\r\n".
"Content-Transfer-Encoding: base64\r\n\r\n";

$headers .= chunk_split(base64_encode($HTML));

mail($to,$subject,"",$headers);

print "mail Sent<br>";
The email I receive has this as text:

</html><body><img src='http://www.somewebsite.com/someimage.jpg'></
body></html>

Thanks!

May 18 '07 #1
Share this Question
Share on Google+
6 Replies


P: n/a
pa***********@gmail.com wrote:
I want to be able to see the email like a html page [snip]
Sending HTML emails is somewhat of a rocket science. It is strongly
recommended that you use a library like Swift Mailer <http://
swiftmailer.org/for your HTML (and other) email needs.

--
Edward Z. Yang GnuPG: 0x869C48DA
HTML Purifier <htmlpurifier.org Anti-XSS HTML Filter
[[ 3FA8 E9A9 7385 B691 A6FC B3CB A933 BE7D 869C 48DA ]]

May 19 '07 #2

P: n/a
Ambush Commander wrote:
pa***********@gmail.com wrote:
>I want to be able to see the email like a html page [snip]

Sending HTML emails is somewhat of a rocket science. It is strongly
recommended that you use a library like Swift Mailer <http://
swiftmailer.org/for your HTML (and other) email needs.

--
Edward Z. Yang GnuPG: 0x869C48DA
HTML Purifier <htmlpurifier.org Anti-XSS HTML Filter
[[ 3FA8 E9A9 7385 B691 A6FC B3CB A933 BE7D 869C 48DA ]]
Edward,

I have to disagree with this. Rockets aren't that complicated!

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
May 19 '07 #3

P: n/a
pa***********@gmail.com kirjoitti:
$HTML = "</html><body><img src='http://www.somewebsite.com/
someimage.jpg'></body></html>";
the </htmlin the beginning is wrong, it should be <html>, no slash there.

--
Ra*********@gmail.com

"Wikipedia on vähän niinq internetin raamattu, kukaan ei pohjimmiltaan
usko siihen ja kukaan ei tiedä mikä pitää paikkansa." -- z00ze
May 19 '07 #4

P: n/a
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jerry Stuckle wrote:
I have to disagree with this. Rockets aren't that complicated!
I'm not sure if you're being facetious enough, so let me expand the
metaphor. Getting a one-time rocket to work is fairly easy: the
materials are cheap and the effect usually works. It's getting things to
work consistently that causes problems. What if, now, he wants to send
multipart MIME emails (which, might I add, is recommended, as HTML
emails should have a text equivalent)?

It's also a matter of reinventing the wheel. Other people have already
figured out the whole HTML email thing out. Use their work!

- --
Edward Z. Yang GnuPG: 0x869C48DA
HTML Purifier <htmlpurifier.org Anti-XSS HTML Filter
[[ 3FA8 E9A9 7385 B691 A6FC B3CB A933 BE7D 869C 48DA ]]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGTxWFqTO+fYacSNoRAoP5AJ9+6NEw+7iH+hrd3v1zf6 sjftUkkgCggRz/
f43rR4F2p2tp4tV5O1OxCRM=
=ZgjA
-----END PGP SIGNATURE-----
May 19 '07 #5

P: n/a
Edward Z. Yang wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jerry Stuckle wrote:
>I have to disagree with this. Rockets aren't that complicated!

I'm not sure if you're being facetious enough, so let me expand the
metaphor. Getting a one-time rocket to work is fairly easy: the
materials are cheap and the effect usually works. It's getting things to
work consistently that causes problems. What if, now, he wants to send
multipart MIME emails (which, might I add, is recommended, as HTML
emails should have a text equivalent)?

It's also a matter of reinventing the wheel. Other people have already
figured out the whole HTML email thing out. Use their work!

- --
Edward Z. Yang GnuPG: 0x869C48DA
HTML Purifier <htmlpurifier.org Anti-XSS HTML Filter
[[ 3FA8 E9A9 7385 B691 A6FC B3CB A933 BE7D 869C 48DA ]]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGTxWFqTO+fYacSNoRAoP5AJ9+6NEw+7iH+hrd3v1zf6 sjftUkkgCggRz/
f43rR4F2p2tp4tV5O1OxCRM=
=ZgjA
-----END PGP SIGNATURE-----
I mean rockets aren't that hard. Not single use rockets - any rockets.

We could send men to the moon almost 25 years before we could send
mime-email - because it was much simpler.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
May 20 '07 #6

P: n/a
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jerry Stuckle wrote:
I mean rockets aren't that hard. Not single use rockets - any rockets.
We could send men to the moon almost 25 years before we could send
mime-email - because it was much simpler.
Nah, that's only because the Soviet Union was pushing us back then. :-)

- --
Edward Z. Yang GnuPG: 0x869C48DA
HTML Purifier <htmlpurifier.org Anti-XSS HTML Filter
[[ 3FA8 E9A9 7385 B691 A6FC B3CB A933 BE7D 869C 48DA ]]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGT7/6qTO+fYacSNoRAtE2AJwK0yRI2NGxUFJ0FWZ7SVToc6bzMwCdH qfn
b5qKk3QGKogLobZRvzpzV3w=
=0i/e
-----END PGP SIGNATURE-----
May 20 '07 #7

This discussion thread is closed

Replies have been disabled for this discussion.