레일스 3을 사용 중이며 이메일 전송 기능을 구현 중입니다. 내 코드를 내 구성이 올 경우 잘 모르겠지만, 현재 위치 :rails 3 이메일 전송 문제
우편물/user_mailer.rb
class UserMailer < ActionMailer::Base
default :from => "[email protected]"
def send_to(user)
@user = user
subject='welcome !'
mail(:to=>'[email protected]', :subject=>subject, :content_type => "text/html")
mail.deliver
end
end
컨트롤러 :
def CarsController < BaseController
...
def register_finish
UserMailer.send_to(user)
end
end
설정/환경. rb
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "smtp.googlemail.com",
:port => 532,
:arguments => '-i'
:enable_starttls_auto => true
}
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
내 컨트롤러가 'register_finish'함수를 호출하고 사용자에게 전자 메일을 보내려고 할 때 항상 Timeout :: Error (실행 만료 됨) 오류 메시지가 표시됩니다. 그 이유는 무엇입니까 ??
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {...}
:
나는 어떤 사람들은
설정/초기화/setup_email.rb의 구성을 정의하고 내가
설정/enviroment.rb 및 사용을 구성하면서
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = { ...}
를 사용했다
또한 'UserMailer'내부에서 컨트롤러를 호출하는 동안 일부 사람들이 컨트롤러에서 "전달"메서드를 호출하는 것을 보았습니다.
내 질문 :
내 구현과 내가 인터넷에서 발견 구현 위의 다른 방법의 차이는 무엇.
왜 시간 초과 오류가 발생합니까?
콘솔이 이메일이 전송되었습니다 보여줍니다 나를 위해 잘 작동하지만, 메일 박스 수신하지 않습니다 ... 그것을 위해 – Mellon
대기, 그것은 잠시 후에 올 수 있습니다) –
아직도받은 :(하지만 주셔서 감사하지 :) – Mellon