php code for email template variables

Discussion in 'Customization & add-ons' started by furboy, Apr 2, 2009.

  1. furboy

    furboy New Member

    Joined:
    Mar 1, 2007
    Messages:
    2
    Is there a way to use php code in email templates?

    My needs: In my send_signup_mail template I want to be able to direct new users to a URL that includes their login name. My config is set to allow spaces in logins and I am sending the email using plain text. If I set up the email template with the text ".../path/{$login}" and the user enters a login that has a space, the email will direct the user to a URL like ".../path/my login" instead of to ".../path/my_login".

    I would like to use the php function urlencode(), but I don't know where to place it. Three solutions I have considered are

    1. Place php code inside the brackets in the template. {urlencode($login)} doesn't work, but I may just have the syntax wrong.
    2. Add a new variable in the file that generates the email variables. This could be the answer, but I can't find which file has the function mail_verification_email()
    3. Add a new field for the url encoded login, add code somewhere to generate the value, and add code somewhere else to allow the template to recognize the field. I don't mind doing this, but it seems like a lot of needless code and database space to simply reformat the output of existing data.

    Thanks.

Share This Page