2012-12-04 16 views
9

मैं ऐसे ऐप पर काम कर रहा हूं जो दृढ़ता से मंड्रिल (मेलचंप की लेनदेन ईमेल सेवा) के साथ एकीकृत हो रहा है और मैं डेविस मेलर को ओवरराइड करने की कोशिश कर रहा हूं लेकिन कुछ कारणों से जब मैं मंडल को एपीआई कॉल भेजता हूं मुझे उनका ईमेल प्राप्त होता है, लेकिन डेविस मुझे एक ईमेल भेजता है (जो खाली है)। http://qnundrum.com/answer.php?q=254917रेल 3 ओवरराइडिंग डिवाइज मेलर

+0

बस मैंने सोचा, लेकिन क्या आपने ** devise.rb ** में 'config.mailer' विकल्प को ओवरराइड करने का प्रयास किया है? – Noz

+0

मैंने किया, अभी भी ईमेल भेज रहा है क्योंकि आपको अपने ओवरराइड – dennismonsewicz

+0

के नीचे सुपर कॉल करना है यदि आप सुपर को कॉल छोड़ देते हैं तो क्या होता है? – mccannf

उत्तर

12

मैं ने वही समस्या में चल रहा था:

यहाँ मेरी DeviseMailer

class MyDeviseMailer < Devise::Mailer 
    def reset_password_instructions(record) 
    mandrill = Mandrill::API.new("#{MandrillConfig.api_key}") 
    mandrill.messages 'send-template', 
      { 
       :template_name => 'Forgot Password', 
       :template_content => "", 
       :message => { 
       :subject => "Forgot Password", 
       :from_email => "[email protected]", 
       :from_name => "Company Support", 
       :to => [ 
        { 
        :email => record.email 
        } 
       ], 
       :global_merge_vars => [ 
        { 
        :name => "FIRST_NAME", 
        :content => record.first_name 
        }, 
        { 
        :name => "FORGOT_PASSWORD_URL", 
        :content => "<a href='#{edit_user_password_url(:reset_password_token => record.reset_password_token)}'>Change My Password</a>" 
        } 
       ] 
       } 
      } 
     #We need to call super because Devise doesn't think we have sent any mail 
     super 
    end 
end 

कॉल super को मैं यहाँ पाया जाता है।

आप निम्नलिखित निर्दिष्ट करने के लिए चिंतन करना प्रारंभकर्ता फ़ाइल (devise.rb) को अद्यतन किया था:

config.mailer = "MyDeviseMailer" 

आप किसी भी और सभी फ़ाइलों को विचारों में/के विचारों/mydevisemailer मेलर स्थानांतरित करने के लिए वसीयत/की जरूरत है।

मैं आपके सर्वर को पुनरारंभ भी करूंगा।

संबंधित मुद्दे