Sending a html file

the mail() function

Moderators: macek, egami, gesf

User avatar
tryton
New php-forum User
New php-forum User
Posts: 49
Joined: Wed Jul 09, 2003 8:25 am
Location: Joze
Contact:

Sending a html file

Postby tryton » Wed Jul 09, 2003 8:36 am

Here's the code:

<?php
...
$handle = fopen ("http://www.healthservicesinc.com/respondLink.htm", "r");
while (!feof ($handle)) {
$buffer = fgets($handle, 4096);
$reply .= $buffer;
}
fclose ($handle);
mail("$email", "Link Exchange from HSI", $reply, "From: hsinc@healthservicesinc.com"); } ?>

What I'm trying to accomplish is to send an html file as an email message to anyone who fills out the form. The problem is that the email message they receive is in pure text meaning the <html>, <body>, <p> tags show up in the email message and not as regular html. I am testing it on a few of my email accounts so I know they can display email as html. Any suggestions or if someone could point me in the right direction I would appreciate. The entire file is in the email message but it just doesn't display as a html file which is what I want.

Note: I just found this forum today and am very impressed by the site and its users, they seem very helpful and friendly as I was looking around for a similar post on this subject before.

Thanks,
JC

User avatar
Oleg Butuzov
Last Samuray
Last Samuray
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Postby Oleg Butuzov » Wed Jul 09, 2003 8:49 pm

dont forget about headers for leter!

php.net/mail


$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
[/img]

User avatar
tryton
New php-forum User
New php-forum User
Posts: 49
Joined: Wed Jul 09, 2003 8:25 am
Location: Joze
Contact:

Thanks a bunch

Postby tryton » Thu Jul 10, 2003 5:12 am

I knew of php.net but misunderstood the reason for the headers. Thanks for the assist.

User avatar
Oleg Butuzov
Last Samuray
Last Samuray
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Postby Oleg Butuzov » Thu Jul 10, 2003 8:13 pm

look at content type it tells what type of file you send.


Return to “PHP coding => Mail”

Who is online

Users browsing this forum: No registered users and 0 guests