私は過去3年間4レール4、工夫&マンドリルのメール
のRailsでアプリを作るしようとしているが、私が把握するのに苦労してきた工夫/ omniauth(私はまだ取得しようとしていますそれは働く)。
私が試してみるうちに主な問題を踏み出し、これを生きる意志を見つけながら、私はMandrillで電子メールを設定しようとしました。
私は私が一緒に従うしようとしています。このチュートリアル、が見つかりました:私はmandrill_devise_mailer.rb
class MandrillDeviseMailer < Devise::Mailer
def confirmation_instructions(record, token, opts={})
# code to be added here later
end
def reset_password_instructions(record, token, opts={})
options = {
:subject => "Reset your 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 to be added here later
end
def mandrill_send(opts={})
message = {
:subject=> "#{opts[:subject]}",
:from_name=> "Reset Instructions",
# :from_email=>"[email protected]",
: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
上記とどのような彼らは、チュートリアルで行っているとの違いと呼ばれるメーラーを持ってhttps://nvisium.com/blog/2014/10/08/mandrill-devise-and-mailchimp-templates/
を以下のとおりです。
私のメールチンパンジーマンドリルテンプレートで、私が持っている:
<a href="*|password_reset_link|*">Change my password </a>
手順をリセットする電子メールが届いたら、パスワード変更フォームの下にある下線付きのリンクが表示されます。私は 'パスワードをリンクテキストを隠すラベルにする'ようにしたい。
私は間違ったことを誰にでも見せてもらえますか? from_email`にメールアドレスのように見えない[ "PROD_WELCOME"] ``に設定されている。ここで
を作成する方法であります私。 – VNO
ありがとうございます - ENVを設定して電子メールを送信するように設定しましたが、変数 – Mel
を取り込むのではなく、* || *の間に単語を表示しますか?デフォルトのマージ言語としてハンドルバーを使用していますか?設定の下であなたのマンドリル[送信オプション](https://mandrillapp.com/settings/sending-options)に行き、適切なマージ言語が有効になっているかどうかを確認してください。 –