Php inside a HTML email

Discussion in 'Templates customization' started by dereck_j2, Mar 9, 2007.

  1. dereck_j2

    dereck_j2 Member

    Joined:
    Aug 22, 2006
    Messages:
    42
    Hi all,

    I am working on the "Admin payment notifications" template.

    What I want to do is place some php script line inside the template as below:
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    <tr>
    <td colspan="2" class="subheaders">{"Total"|string_format:"%-50s"}</td>
    <td class="subheaders">{$config.currency|default:"$"}{$total|string_format:"%.2f"}</td>
    <td class="bodytext"> </td>
    <td class="bodytext">
    <?php
    $header = "From: accounts@mydomain.com\r\n";
    $header .= "Reply-To: accounts@mydomain.com\r\n";
    $header .= "MIME-Version: 1.0 \r\n";
    $header .= "Content-type: text/html; charset=iso-8859-1\r\n";
    $header .= "From: ".$Name;
    $subject = " Order" {$user.member_id};
    $to = "myname@mydomain.com";
    $message = "<br>"
    . "Please action the following order for B.<p>"
    . "This is an automated email form,<br>"
    . "The Team<br>"
    . "<a href=\"mailto:myname@mydomain.com\">myname@mydomaincom</a>"
    . "</html>";

    mail($to, $subject, $message, $header);

    ?> </td>
    </tr>
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    I keep getting the following error:

    <br />
    <b>Parse error</b>: parse error, unexpected '?' in <b>/homepages/41/d43000764/htdocs/mydomain/amember/smarty/SmartyNoWrite.class.php(216) : eval()'d code</b> on line <b>178</b><br />

    Can this be done and if so how do I approach the problem.

    many thanks

    Dereck
  2. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    there is PHP syntax error in the code and it causes this error.

Share This Page