Trying to get this to echo the body to for testing, not having it...
Results 1 to 4 of 4

Thread: Trying to get this to echo the body to for testing, not having it...

  1. #1
    Junior Member
    Join Date
    Jun 2013
    Posts
    2

    Trying to get this to echo the body to for testing, not having it...

    PHP Code:
     <?
        
    function getRandomString($length 6) {

            
    $validCharacters "1234567890";

            
    $validCharNumber strlen($validCharacters);

            
    $result "";

            for (
    $i 0$i $length$i++) {

                
    $index mt_rand(0$validCharNumber 1);

                
    $result .= $validCharacters[$index];
        }
     return 
    $result;
    }
    ?>

    <?
    # assign send email (actual email address redacted)
    $to "patrick@omited.com";

    # assemble header
    $header "Reply-To: ".$_POST['email']."\nFrom: ".$_POST['email'];

    # fix subject
    $subject "Ticket Number";

    #url
    $url "www.omited.com/portal/ticket-status.php?ticket_no=";

    #ticket number
    $ticket getRandomString();

    # assemble body
    $body "Hello,
    -----------------------------------------------------

    "
    ;
    $body .= "Ticket Number: <a href="".$url. .$ticket. "\">".$ticket."</a>" "\n";   <-----this is the line that is throwing errors--->
    $body .= "Favorite Location: ".$_POST['fav']."\n";

    # send mail
    mail($to,$subject,$body,$header); 

    ?>

    <? echo $url ?><? echo getRandomString(); ?><br>
    <? echo $body ?>
    WHat the heck am i doing wrong?
    I keep getting Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING on line 41

  2. #2
    Pedantic Curmudgeon Weedpacket's Avatar
    Join Date
    Aug 2002
    Location
    General Systems Vehicle "Thrilled To Be Here"
    Posts
    21,906
    You're missing a . between the " and the " near the end of that line.
    THERE IS AS YET INSUFFICIENT DATA FOR A MEANINGFUL ANSWER
    FAQs! FAQs! FAQs! Most forums have them!
    Search - Debugging 101 - Collected Solutions - General Guidelines - Getting help at all

  3. #3
    Junior Member
    Join Date
    Jun 2013
    Posts
    2

    Another issue with this code...

    PHP Code:
    <?
    # assign send email (actual email address redacted)
    $to "patrick@omited.com";

    # assemble header
    $header "Reply-To: ".$_POST['email']."\nFrom: ".$_POST['email'];

    # fix subject
    $subject "Ticket Number";

    #url
    $url "http://www.omited.com/portal/ticket-status.php?ticket_no=";

    #ticket number
    $ticket $_POST['ticketnumber'];

    # assemble body
    $body .= "<html><body>"."\n";
    $body .= "Hello ".$_POST['name'].",<br>
    <br>
    "
    ;

    $body .= "Check Computer Status: <a href=\"".$url.$ticket."\">".$ticket."</a><br>"."\n";
    $body .= "Favorite Location: ".$_POST['fav']."\n";
    $body .= "</html></body>"."\n";

    # send mail
    mail($to,$subject,$body,$header); 

    ?>
    It will not send the email in HTML its just plain test, any idea how to fix this?
    THis is how it looks in my email:
    HTML Code:
    <html><body>
    Hello Patrick omited,<br>
    -----------------------------------------------------<br>
    <br>
    Check Computer Status: <a href="http://www.omited.com/portal/ticket-status.php?ticket_no=089028">089028</a><br>
    Favorite Location: 
    </html></body>

  4. #4
    Pna lbh ernq guvf¿
    Join Date
    Jul 2004
    Location
    Kansas City area
    Posts
    19,432
    Add a 'Content-Type' header to your e-mail headers to specify the correct type of the content.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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