Jump to content

Recommended Posts

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

here is my code

[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[/code]

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
Link to comment
https://forums.phpfreaks.com/topic/15399-html-as-text-in-email/
Share on other sites

Hi

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

[code]   

//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);
[/code]




hope it helps
Link to comment
https://forums.phpfreaks.com/topic/15399-html-as-text-in-email/#findComment-62417
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.