Рельсы не отправляющие почту в локальной среде
Я не могу заставить мой почтовик работать в среде разработки. Это моя конфигурация на развитие.rb:
config.action_mailer.default_url_options = { host: 'localhost:3000' }
config.action_mailer.perform_deliveries = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
address: 'smtp.mandrillapp.com',
port: 587,
enable_starttls_auto: true,
user_name: 'user@email.com,
password: 'mypassword,
authentication: 'login',
domain: 'mandrill.com'
}
Мой почтовый метод:
class InformationRequestMailer < ActionMailer::Base
def information_request(operator, ref, property_url, contact_info)
@operator = operator
@property_url = property_url
mail(to: operator.email, subject: t("information_request_mailer.subject", property_ref: ref))
end
end
И вот я это называю
InformationRequestMailer.delay.information_request(
operator: operator,
ref: ref,
property_url: property_url,
contact_info: params[:contact_info]
)
Заранее спасибо.
1 ответ
Если у вас есть ток Rails
версия, это должно работать:
InformationRequestMailer.information_request(
operator: operator,
ref: ref,
property_url: property_url,
contact_info: params[:contact_info]
).deliver_later
А поскольку вы хотите использовать отложенную доставку, вам нужно запустить рабочих в очереди.