сталкивается с проблемой в действии почтовик - PullRequest
0 голосов
/ 25 августа 2011

сталкивается с проблемой в действии почтовой программы. мой почтовик

  def registration_confirmation(user)
    subject    "Password Reset Instructions"
    from        "sender_email_id@test.com"
    recipients  user.email
    content_type "text/html"
    body        "RESET your Password"
  end

Настройки для почтовика

require 'development_mail_interceptor'

ActionMailer::Base.smtp_settings = {
  :address              => "smtp.gmail.com",
  :port                 => 587,
  :domain               => "domain.in",
  :user_name            => "admin@domain.in",
  :password             => "PASSWORD",
  :authentication       => "plain",
  :enable_starttls_auto => true
}

ActionMailer::Base.default_url_options[:host] = "localhost:3000"
Mail.register_interceptor(DevelopmentMailInterceptor) if Rails.env.development?

и мой контроллер UserMailer.registration_confirmation(@new_user).deliver

Почта не отправляется на user.email, она всегда отправляется на admin@domain.in

.

Я использую mail-v 2.2.19 и rails 3.0.9

пожалуйста, помогите.

1 Ответ

1 голос
/ 26 августа 2011

попробуйте добавить эту строку (работает для меня):

mail(:to => user.email, :subject => "Password Reset Instructions")

в ваш метод регистрации_подтверждения

def registration_confirmation(user)
    from        "sender_email_id@test.com"
    content_type "text/html"
    body        "RESET your Password"
    mail(:to => user.email, :subject => "Password Reset Instructions")
end
...