레일즈 3.2.3 응용 프로그램이 잘 작동하고 작성한 메일 메시지를 전달하기 때문에 등록 확인과 비밀번호는 메일 메시지를 잊어서 새 비밀번호를 설정합니다.레일스 3 메일이 작동하지 않으나 메일이 작동하지 않습니다.
그러나 메일 알림을 전달하려는 다른 장소가 있습니다.
이것은 내 Notifier
모델입니다.
# encoding: utf-8
class Notifier < ActionMailer::Base
default from: "[email protected]"
default to: "[email protected]"
def new_post_submitted(post)
@post = post
mail(subject: "Anúncio enviado: #{@post.title}")
end
def new_message(message)
@message = message
mail(subject: "Mensagem de contato: #{@message.subject}")
end
end
와 컨트롤러가 호출
def create
@message = Message.new(params[:message])
if @message.valid?
Notifier.new_message(@message).deliver
redirect_to(root_path, :notice => "Obrigado. Sua Mensagem enviada com sucesso")
else
flash.now.alert = "Por favor preencha todos os campos."
render :new
end
end
로그 출력이 전달 된 말한다 :
Started POST "/contato" for 187.57.102.168 at 2012-08-31 11:28:51 +0900
Processing by ContactController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"TVdmDYCA4x3JVi+9pMcpY7OSU/P1lE9enLiFJlK9W1M=", "message"=>{"name"=>"kleber", "email"=>"[email protected]", "subject"=>"teste", "body"=>"hello there"}, "commit"=>"Enviar"}
Rendered notifier/new_message.html.erb (0.1ms)
Sent mail to [email protected] (152ms)
Redirected to http://www.domain.com/
Completed 302 Found in 158ms (ActiveRecord: 0.0ms)
그리고 내 config/production.rb
파일에 다음과 같은 구성.
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "localhost",
:port => 25,
:domain => "domain.com",
:authentication => :login,
:user_name => "[email protected]",
:password => "mypassword",
:enable_starttls_auto => false
}
여기에 무슨 일이 일어나고 있는지 실마리가 있습니까?
스팸 이메일을 확인하셨습니까? –
예, 거기에는 아무 것도 없습니다. –
및 시스템 로그 폴더? (/ var/log, 즉 /var/log/mail.log) 경고/오류가 있습니까? –