logo
down
shadow

How do I add instance variables to Devise email templates?


How do I add instance variables to Devise email templates?

By : swinnn
Date : November 17 2020, 11:58 AM
To fix the issue you can do I am trying to edit the confirmation_instructions.html.erb file to address the new user by first name instead of email. , This is easy, you can just create a Mailer for this:
code :
class ConfirmationsMailer < Devise::Mailer
  default from: '<no-reply@example.com>'

  def confirmation_instructions(record, token, opts={})
   @token = token
   #you can add your instance variables here
   devise_mail(record, :confirmation_instructions, opts)
  end
end
Devise.setup do |config|
...
config.mailer = 'ConfirmationsMailer'
...
end


Share : facebook icon twitter icon
How to use custom customer variables in transactional email templates in magento?

How to use custom customer variables in transactional email templates in magento?


By : Kari Kari
Date : March 29 2020, 07:55 AM
wish of those help I have added some custom variables to customer and I want to use them in email template. , I done similar task with code like below:
code :
$setup->addAttribute('customer', 'attr_name', array(
    'type'      => 'int',
    'input'     => 'select',
    'label'     => 'Attr label',
    'global'    => 1,
    'visible'   => 1,
    'required'  => 1,
    'default'   => '0',
    'user_defined'      => 1,
    'visible_on_front'  => 1,
));
if (version_compare(Mage::getVersion(), '1.6.0', '<='))
{
      $customer = Mage::getModel('customer/customer');
      $attrSetId = $customer->getResource()->getEntityType()->getDefaultAttributeSetId();
      $setup->addAttributeToSet('customer', $attrSetId, 'General', 'attr_name');
}
if (version_compare(Mage::getVersion(), '1.4.2', '>='))
{
    Mage::getSingleton('eav/config')
        ->getAttribute('customer', 'attr_name')
        ->setData('used_in_forms', array('customer_account_create'))
        ->save();
}
how to access the devise @user instance variable outside of the devise controller & templates

how to access the devise @user instance variable outside of the devise controller & templates


By : Aurélien Perronneau
Date : March 29 2020, 07:55 AM
Does that help So I have an app that has user profiles, now bare in mind the user_profile.html.erb template is associated with the home_controller, not any devise controllers. , Use current_user:
code :
form_for(current_user)
Nil instance variables in Rails view after subclassing Devise controller

Nil instance variables in Rails view after subclassing Devise controller


By : Bhanu Anu Ghattamane
Date : March 29 2020, 07:55 AM
seems to work fine The matching action in Devise parent controller has full rendering mechanism.
So, when you call super, the parent action took it over, work, and end the story. Your custom instance variable never had a chance to be copied to view.
can't pass variables to pug/jade template with node email templates

can't pass variables to pug/jade template with node email templates


By : Avtar Singh
Date : March 29 2020, 07:55 AM
hop of those help? Ended up not being an issue with the code, but with the webstorm file watcher putting an html file in the email-templates template directory causing the render to fail
Email Templates With Variables

Email Templates With Variables


By : Nyi Nyi Lwin
Date : March 29 2020, 07:55 AM
hop of those help? I'm using code, written with help from this forum, to select a .oft email template from a central repository via a drop down menu. , You can pass the values and replace unique placeholders like this:
code :
Option Explicit

Private Sub userpass()

Dim userName As String
Dim userPassword As String

userName = "someBody"
userPassword = "easilyBroken"

MyTemplate userName, userPassword

End Sub

Private Sub MyTemplate(uName, uPword)

Dim msg As mailitem

' Template with unique text "Username:" and "Password:"
Set msg = CreateItemFromTemplate("C:\Test\Account Creation SC.oft")

With msg
    .body = Replace(.body, "Username:", "Username:" & uName)
    .body = Replace(.body, "Password:", "Password:" & uPword)
End With

msg.Display

End Sub
shadow
Privacy Policy - Terms - Contact Us © ourworld-yourmove.org