Rails 4.0의 경우 (Rails 4.1은 secrets.yml 파일을 사용하여 자격 증명을 설정합니다) :
config / environments / development.rb 파일을 확인하면 다음이 있어야합니다.
config.action_mailer.smtp_settings = {
address: "smtp.gmail.com",
port: 587,
domain: ENV["DOMAIN_NAME"],
authentication: "plain",
enable_starttls_auto: true,
user_name: ENV["GMAIL_USERNAME"],
password: ENV["GMAIL_PASSWORD"]
}
# ActionMailer Config
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.raise_delivery_errors = true
# Send email in development mode.
config.action_mailer.perform_deliveries = true
ENV [ "GMAIL_USERNAME"]을 Gmail 사용자 이름으로 바꾸세요.
Unix 셸에서 ENV [ "GMAIL_USERNAME"]을 설정할 수 있습니다. 또는 config / application.yml 파일에서 설정하십시오 . 사용자 이름에 알파벳이 아닌 문자가 포함 된 경우 config / application.yml 파일에서 따옴표로 묶어야 할 수 있습니다 .
-------------------매개 변수 이름이 올바른지 다시 확인하십시오. 나를 위해 문제 username
를 user_name
해결했습니다.
오류를 보려면의 값을 config.action_mailer.raise_delivery_errors
로 변경하십시오 true
. Rails 4가 있고 제대로 작동하기 위해 설정을 변경할 필요가 없습니다.
@Toontje와 @Daniel Kehoe에게 감사드립니다.
출처
https://stackoverflow.com/questions/22050315