Ruby on Rails를 사용하고 있는데, Mandrill을 사용하여 메일을 송수신하는 방법을 가르쳐 주시겠습니까?Mandrill을 사용하여 메일을 보내고받는 방법?
내 문제는 사용자가 텍스트를 입력하고 제출을 누르면 내 메일에 메시지를 보내려고합니다. 설명서를 읽었지만 이해가되지 않습니다.
이
은 production.rb 같은 내 development.rb입니다ActionMailer::Base.smtp_settings = {
:port => '587',
:address => 'smtp.mandrillapp.com',
:user_name => '[email protected]',
:password => 's82SlRM5dPiKL8vjrJfj4w',
:domain => 'heroku.com',
:authentication => :plain
}
ActionMailer::Base.delivery_method = :smtp
user_mailer.rb : 같은
def index
UserMailer.welcome.deliver
end
내 로그 파일보기 :
class UserMailer < ActionMailer::Base
default from: "[email protected]"
def welcome
mail(to: "[email protected]", subject: "Welcome", body: "Have a nice day")
end
end
및 컨트롤러
이 :Started GET "https://stackoverflow.com/users/" for 127.0.0.1 at 2014-01-21 16:14:10 +0700
Processing by UsersController#index as HTML
Sent mail to [email protected] (2008.0ms)
Date: Tue, 21 Jan 2014 16:14:10 +0700
From: [email protected]
To: [email protected]
Message-ID: <[email protected]>
Subject: Welcome
Mime-Version: 1.0
Content-Type: text/plain;
charset=UTF-8
Content-Transfer-Encoding: 7bit
Have a nice day
Rendered text template (0.0ms)
Completed 200 OK in 2018ms (Views: 1.0ms | ActiveRecord: 0.0ms)
감사합니다. 시도했지만 아직 메일을받지 못했습니다. 'default : "[email protected]" def welcome_email mail ([email protected], 제목 : "내 웹 사이트에 오신 것을 환영합니다") end' – user3214298
올바른 사용자 이름과 apikey를 사용하셨습니까? 일시적으로'ENV []'를 삭제하고 그냥 일반 문자열을 삽입하십시오. 또한 환경 .rb 파일에'config.action_mailer.delivery_method = : smtp'가 있는지 확인하십시오. –
도움을 주셔서 감사합니다. 그러나 여전히 작동하지 않습니다 ... 내 파일 내용을 게시했습니다 ... – user3214298