SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Guru
    Join Date
    Feb 2007
    Posts
    731
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Echo PHP In Email

    Hi,

    I am trying echo an activation code in an email. However whatever I try including putting them inside the PHP tags just displays the text instead of any form of PHP being echoed.

    Can anyone advise how I can echo PHP inside an email. I am using single commas to start and finish the email, is that the problem?


    Code:
              $message = '
    <html>
    <body>
    Welcome to Website.com <br><br>
    <php echo $activationcode ?>
    <a href="http://www.eventvital.com/test/activation.php?activation=$activationcode"
     ?>Click Here</a> to activate your account.
    
    </body>
    </html>
    ';

  2. #2
    Non-Member
    Join Date
    Oct 2007
    Posts
    363
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    It's because you're just making the php code part of a string.

    You need to come out of the string and get rid of the echo statement.

    Something like this:

    PHP Code:
              $message '
    <html>
    <body>
    Welcome to Website.com <br><br>' 
    .
    $activationcode .'
    <a href="http://www.eventvital.com/test/activation.php?activation='
    .$activationcode.'"
     ?>Click Here</a> to activate your account.

    </body>
    </html>
    '

    Edit: Note the placement of the full stops and the placement of the ' marks.


Bookmarks

Posting Permissions

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