Forum Moderators: coopster

Message Too Old, No Replies

send html page as a mail

send html page as a mail

         

vivek avasthi

7:15 pm on Aug 2, 2006 (gmt 0)

10+ Year Member



hi friends i have a html page and i want to send it as a mail ...

the example strings is :

$htmltext='<TABLE cellpadding="0" cellspacing="0" border="0" width="100%">
<TR>
<TD align="center">
<FONT COLOR="#606060"><A HREF="http://www.example.com/files/register.php" class="bottom">New User? Register Here</A> ¦ <A HREF="http://www.example.com/login_new.php?go_to=my_account.php" class="bottom">Login</A> ¦ <A HREF="http://www.example.com/files/register.php" class="bottom">Make Profile</A> ¦ <A HREF="http://www.example.com/my_account.php" class="bottom">My Profile</A> ¦ <A HREF="http://www.example.com/search.php" class="bottom">Search</A> ¦ <A HREF="http://www.example.com/refer2.php" class="bottom">Refer example.com</A><BR>
<a href="http://www.example.com/index.php" class="bottom">Home</a> ¦ <a href="http://www.example.com/faq.php" class="bottom">FAQs</a> ¦
<a href="http://www.example.com/terms.php" class="bottom">Terms & Conditions </a>¦ <a href="http://www.example.com/disclaimer.php" class="bottom"> Disclaimer </a> ¦ <a href="http://www.example.com/feedback.php" class="bottom">Feedback</a> ¦ <A HREF="http://www.example.com/dating-links" class="bottom">Dating Directories</A>
</td>
</tr>
<td class="bottom" align="center"><BR>
Copyright © 2005 <b><a href="http://www.example.com/index.php" class="smallbottom"><u>example.com</u></a></b> All rights Reserved. In association with <A HREF="http://www.example.com" class="smallbottom">example.com Online Dating Service</A><BR><A HREF="http://www.example.com/Search-Engine-Optimization/" class="smallbottom">Search Engine Optimization</A>, <a href="http://www.example.com" target="_blank" class="smallbottom">Website Designing & Development by example.Com</a>
</FONT>
<BR><BR>
</TD>

</TR>
</TABLE>';

now i want to send this htmltext to as a mail...but when i send it it displayed as it is .. i want to display it as a HTML not as a string ...anyone can help me..

[edited by: coopster at 9:21 pm (utc) on Aug. 3, 2006]

diegomh7

7:30 pm on Aug 2, 2006 (gmt 0)

10+ Year Member



ELO first of all change all the HMTL "" > ''

so that it works in a string

from things like this :

<table width="100" height = "200">

to like this

<table width='100' height= '200'>

then use this :

<?php

// to recipients
$to .= 'info@domain.co.uk';

// subject
$subject = 'Birthday Reminders for August';

// message
$message = '
<html>
<head>
<title>Birthday Reminders for August</title>
</head>
<body>
<p>Here are the birthdays upcoming in August!</p>
<table>
<tr>
<th>Person</th><th>Day</th><th>Month</th><th>Year</th>
</tr>
<tr>
<td>Joe</td><td>3rd</td><td>August</td><td>1970</td>
</tr>
<tr>
<td>Sally</td><td>17th</td><td>August</td><td>1973</td>
</tr>
</table>
</body>
</html>
';

// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

// Additional headers
$headers .= 'To: info <info@domain.co.uk>, info <info@domain.co.uk>' . "\r\n";
$headers .= 'From: info <info@domain.co.uk>, info <info@domain.co.uk>' . "\r\n";
$headers .= 'Cc: webmaster@domain.co.uk' . "\r\n";
$headers .= 'Bcc: info@domain.co.uk' . "\r\n";

// Mail it

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

$erm = "The email has been sent successfully";

echo "<center><b>$erm</b></center>";

?>

There you go mate,

regards,

Diegomh7