Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2004
    Posts
    10

    Unanswered: email is not displaying HTML

    I have a email problem with the following code. This was perfectly working fine and sending a

    HTML email earlier. Recently we have moved to a new server and the email does not display the

    HTML, it just displays as a text message. Can some one advice me in this regard?

    Thanks in advance fro your help!

    --------------------------------------------

    <? include("config.php")?>
    <?
    $sql = "insert into tbluser (
    yourName,
    yourEmail,
    yourFName,
    friendsEmail,
    yourMessage,
    yourScore,
    post_date
    ) values ('".
    $_POST['yourName']."','".
    $_POST['yourEmail']."','".
    $_POST['yourFName']."','".
    $_POST['friendsEmail']."','".
    $_POST['yourMessage']."','".
    $_POST['yourScore']."','".
    date('y-m-d',strtotime("now()"))."')";
    //die($sql);
    mysql_query($sql) or die("Error is ".mysql_error());
    $id = mysql_insert_id();
    if (isset($_POST['yourEmail'])){
    $HTML = "Dear ".$_POST['yourFName'].",\n\n";
    $HTML .= "Check out this cheeky little outfit designed by me exclusively for tutticuti™!<br><br

    />Click on the following link to view the outfit.<br><br><a

    href='http://www.domainname.com/folder/game/viewDesign1.php?id=".$id."'

    target='_blank'>http://www.domainname.com/folder/game/viewDesign1.php?id=".$id."</a>
    <br><br>
    ".$_POST['yourMessage']."
    <br><br>Thanks,<br>".$_POST['yourName'];

    $HTML .= "I have just found a fantastic new titti cuti ice cream game at Santoro website and I

    have scored ".$_POST['yourScore']." points. If you want to play the game and beat my score,

    please go the following web site.\n
    http://www.santorographics.com/tutticuti/icecreamgame\n
    ".$_POST['yourMessage']."\n
    Have fun. Cheers!\n\n".$_POST['yourName'];

    $to = $_POST['friendsEmail'];
    $sub = "Your friend (".$_POST['yourName'].") sent you an email.";
    $headers = "MIME-Version: 1.0\r\n";
    $headers = "Content-type: text/html; charset=iso-8859-1\r\n";
    $headers = "Return-Path: bounces@domain.com\r\n";
    $headers = "bcc: webmaster@domain.com\r\n";
    $headers = "From: ".trim($_POST['yourName'])."<".trim($_POST['yourEmail']).">\r\n";
    mail($to, $sub, $HTML, $headers);
    }
    ?>
    ------------------------

  2. #2
    Join Date
    Apr 2006
    Location
    Denver, Co. USA
    Posts
    242
    Since you are actually receiving the email, about the only thing that stands out is that your html content in the message needs to be surrounded by html tags -

    <html>
    <head>
    </head>
    <body>

    Your existing message content here...

    </body>
    </html>

  3. #3
    Join Date
    Jan 2004
    Posts
    10
    Yeah, I tried but could not work... any other suggestion?

  4. #4
    Join Date
    Apr 2006
    Location
    Denver, Co. USA
    Posts
    242
    Upon further review of your code, the $headers variable is not being built correctly. It is not being concatenated and is actually only being set to the last line.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •