phphtmlswiftmailer

using php variables in a html email using swiftmailer


Im using swiftmailer to send my emails from my site. I'm trying to get a html email to send but in my php code i want to pass a php variable in to the email.

Is this possible and if so where am i going wrong?

->setBody(
        '<html>' .
        ' <head></head>' .
        ' <body>' .
        '  Welcome to my site. To complete registration, please click activate below' .
        '  <a href="http://www.mysite.com/activate.php?=c' . <?php rawurlencode ($code);?>'">activate' .
        ' </body>' .
        '</html>',
        'text/html'
);

Solution

  • I don't understand why you are using this

    <?php rawurlencode ($code);?>
    

    unless than

    rawurlencode ($code)