Jump to content


Photo

Html as text in email


  • Please log in to reply
2 replies to this topic

#1 cody7

cody7
  • Members
  • PipPip
  • Member
  • 15 posts

Posted 23 July 2006 - 03:52 PM

Hi i'm having problem sending an HTML code in emails

here is my code

$message = "<html><head><title>My Title</title></head><body>The Body</body></html>";
$message = htmlentities($message);
// my line of code that send this message on my yahoo email

when i check my email heres what i see

<html><head><title>My Title</title></head>

in case you don't notice the text starting from the <body> tag is gone

can anyone help me with this, i just want to see the exact html code treated as text in my email like this:

<html><head><title>My Title</title></head><body>The Body</body></html>

Thanks for any help you can give me

#2 avo

avo
  • Members
  • PipPipPip
  • Advanced Member
  • 148 posts
  • Locationstaffordshire uk

Posted 23 July 2006 - 04:00 PM

Hi

mod and studdy this code i written this for one of my web sites i have taken my web address out 

    

	//Email 
    $to = $customer_email ;
    $from = "from-email-address";
    $subject = "Password Reminder";

    //begin of HTML message
	

$message = <<<EOF
<html>
    <style type="text/css">
<!--
.style2 {color: #FF0000}
.style4 {color: #6AA4B2}
.style6 {color: #FCAD00}
.style10 {font-size: 18px; color: #0000FF; }
.style11 {font-family: Tahoma}
-->
    </style>
  <body bgcolor="#DCEEFC">
<center>
  <br>
  <br/>
        <div align="center" class="style11"><strong>Password Reminder For<span class="style10"> $realname</span></strong></div>
</center>

  <p>
    <left>      </left>
  </p>
  <table width="800" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#00CCCC">
    <tr>
      <td height="285" scope="col"><left><strong> </strong></left>
        <div align="left">
          <p><span class="style11"><strong>&nbsp;&nbsp;Hello </strong></span><span class="style10"><strong>$realname</strong></span><span class="style11"><strong><br>
  &nbsp;&nbsp;This is your password Reminder From <span class="style4">Team</span><span class="style6">Console</span>.<br/>
  &nbsp;&nbsp;Please find your password bellow.<br/><br>
          &nbsp;&nbsp;You have received this e-mail because you requested a password reminder<br>
&nbsp;&nbsp;If you did not request this reminder please e-mail<br/>
<br>
&nbsp;&nbsp;Please click <a href="http://page-toclick-non"></a> and login to your account.<br>
<br/>
          &nbsp;&nbsp;Your Username Is <span class="style2">$user_name</span><br>
          &nbsp;&nbsp;Your Password Is <span class="style2">$frg_password<br/>
            </span><br>
          &nbsp;&nbsp;Please keep your password safe and secure.<br>
          &nbsp;&nbsp;Please remember your password is cAsE sEnSiTiVe.<br/>
          <br>
          &nbsp;&nbsp;This E-mail address is not monitored. Please Do Not reply!<br>
          <br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</strong></span></p>
        </div></td>
    </tr>
  </table>
  <p align="center">

    <a href="http://page-toclick-non" class="style11"></a>  </p>
  </body>
</html>
EOF;


   //end of message
   
    $headers  = "From: $from\r\n";
    $headers .= "Content-type: text/html\r\n";

    //options to send to cc+bcc
    //$headers .= "Cc: [email]maa@p-i-s.cXom[/email]";
    //$headers .= "Bcc: [email]email@maaking.cXom[/email]";
    
    // now lets send the email.
    mail($to, $subject, $message, $headers);




hope it helps
Im loving it ........

#3 cody7

cody7
  • Members
  • PipPip
  • Member
  • 15 posts

Posted 23 July 2006 - 04:09 PM

i got it! i just use

Content-type:  text/plain

instead of

Content-type: text/html

anyway thank you for posting your help  avo.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users