How to get the email ID in every email template.

I'm implementing a extension for customer autologin from email. By clicking on the link in the email - that customer should logged in by emailid.

I got the code for autologin by customer's email id

But I need to use the customer's email with a link in every email template.

how to get the receiver's email id in the email template?

Thanks in advance.

  • What do you mean by email id? Also an id sounds like it could be easily guessed which means someone could abuse this feature to log in as someone else... Feb 11, 2015 at 20:26
  • @Fooman I have plans to append encrypted key with the link and email id.. If the encrypted key and email id matches then only customer login should work. And I have plans to implement expiry time for that encrypted key also. now i stuck at this point so I posted this question. Feb 11, 2015 at 20:32
  • @GirishSH ... Can you add more info on how or where you are sending email. Can you add your email logic Feb 11, 2015 at 20:49
  • @R.S I need to add the link to all the mails which will go from our site. Like newsletters, Order tracking email, Order confirmation email etc.. Once the customer clicks on that link in the mail, it should loggin automatically into site. Feb 11, 2015 at 20:54
  • @GirishSH ... Where are you storing this info ..Normally each email have to passing there own custom variables. Take a look at stackoverflow.com/questions/11393479/… and magento.stackexchange.com/questions/54444/… Feb 11, 2015 at 21:00

1 Answer 1


If you are talking about customer_id use {{customerobject.customer_id}} in the template you want. Replace customerobject with an object containing the customer and that should do the trick.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.