Rails 4, Devise & Mandrill emails -


i'm trying make app in rails 4.

for past 3 years, i've been struggling figure out devise/omniauth (i still trying work).

stepping aside main problems while try , find live through this, i've tried setup emails mandrill.

i found tutorial, trying follow along: https://nvisium.com/blog/2014/10/08/mandrill-devise-and-mailchimp-templates/

i have mailer called mandrill_devise_mailer.rb

class mandrilldevisemailer < devise::mailer    def confirmation_instructions(record, token, opts={})     # code added here later   end    def reset_password_instructions(record, token, opts={})     options = {       :subject => "reset password",       :email => record.email,       :global_merge_vars => [         {           name: "password_reset_link",           # content: "http://www.example.com/users/password/edit?reset_password_token=#{token}"           content: "http://www.cr.com/users/password/edit?reset_password_token=#{token}"          },          {           name: "password_reset_request_from",           content: record.full_name          }       ],       :template => "forgot password"     }     mandrill_send options     end    def unlock_instructions(record, token, opts={})     # code added here later   end    def mandrill_send(opts={})     message = {        :subject=> "#{opts[:subject]}",        :from_name=> "reset instructions",       # :from_email=>"example@somecorp.com",       :from_email=>["prod_welcome"],       :to=>             [{"name"=>"#{opts[:full_name]}",                 "email"=>"#{opts[:email]}",                 "type"=>"to"}],       :global_merge_vars => opts[:global_merge_vars]       }     sending = mandrill.messages.send_template opts[:template], [], message     rescue mandrill::error => e       rails.logger.debug("#{e.class}: #{e.message}")       raise   end end 

the differences between above , have done in tutorial are:

in mail chimp mandrill template, have:

<a href="*|password_reset_link|*">change password </a> 

when receive email reset instructions, underlined link change password form, says 'change password next it. want 'change password label conceals link text'.

can see i've done wrong?

here how created custom devisemailer

class mydevisemailer < devise::mailer      default template_path: 'devise/mailer' # make sure mailer uses devise views    def reset_password_instructions(record, token, opts={})     opts['from_email'] = "donotreply@mywebsite.com"     opts['from_name'] = "password reset"     #rails.logger.mail.info "reset_password_instructions #{record.to_json} \n #{token.to_json} \n #{opts.to_json}"     super   end  end 

https://github.com/plataformatec/devise/wiki/how-to:-use-custom-mailer , add dynamic value in devise email subject


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -