아마 수백만 번 질문을 받았을 것입니다. 내 경우가 다르기 때문에 상상할 수있는 모든 설정 옵션을 시도해보고 프로덕션 모드에서도 사용해 보았습니다. 전자 메일이 렌더링되지만 아무데도 나타나지 않습니다. 이메일을보기 위해 15 달러짜리 MockSMPT 앱을 샀는데 아무 것도 나오지 않는 것 같습니다. 여기 Rails 3 Action Malier는 템플릿을 렌더링하고 이메일을 보내지 않습니다.
는 MockSMTP의 CONFIGS 있습니다Rendered contact_mailer/contact_email.html.erb (2.1ms)
을 그리고 이것은 그 것이다 :
config.action_mailer.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "localhost",
:port => 1025,
:domain => "whatever.com"
}
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_deliveries = true
내가 시도 모든 delivery_method
는 :test
는 :file
, 나는 내 머리를 추출하고, 아무것도 할 수 없습니다. 보내는
코드는 간단하다 :
def contact_email(contact, house=nil)
@house=house if house
@contact=contact
mail(to: contact.email, subject: "#{contact.name} new inquiry")
end
Rails 3.2.8
contact_controller.rb
:
def create
@contact = Contact.new(params[:contact])
if @contact.valid?
@house=House.find_by_id(params[:house_id])
ContactMailer::contact_email @contact, @house
end
end
전자 메일을 보내는 코드와 사용중인 레일 버전을 공유 할 수 있습니까? –
코드가 추가되었습니다. – firedev
실제로 메일러 동작을 호출하는 코드는 컨트롤러의 어딘가에있을 수 있습니까? –