faaarrrrr에 너무 오래 문제가 발생했습니다. 나는 문자 그대로 무수한 질문을 광산과 비슷하게 보았고 그들 중 누구도 일할 수없는 것처럼 보였다.Heroku 설정하기 SendGrid 문제
저는 cloud9 ide를 사용해 왔고 heroku에게 SendGrid를 사용하여 간단한 이메일을 보내려고 시도했습니다. 나는이 문제가 production.rb의 설정에 있거나 SendGrid를 사용하여 heroku를 설정 한 방법이라고 확신하지만 실제로는 끝내고있다.
config.action_mailer.default_url_options = { :host => 'http://tranquil-plateau-41839.herokuapp.com' }
환경 폴더의 production.rb 파일에 입력했습니다.
UserMailer.welcome_email(@user).deliver_now
이것은 사용자가 저장하면 실행하는 if 문 안에 내 user.rb 파일에 앉아있다. 이 작업을 수행하기 위해 백만 가지 조합을 시도 했으므로 원하지 않는 것처럼 보입니다.
이 내가 Heroku가에서 무엇을 얻을은
2017-11-18T04:40:06.396183+00:00 app[web.1]: (2.1ms) COMMIT
2017-11-18T04:40:06.396635+00:00 app[web.1]: Completed 302 Found in 140ms (ActiveRecord: 37.3ms)
2017-11-18T04:40:06.396468+00:00 app[web.1]: Redirected to http://tranquil-plateau-41839.herokuapp.com/login
2017-11-18T04:40:06.459084+00:00 app[web.1]: Started GET "/login" for 173.28.213.164 at 2017-11-18 04:40:06 +0000
2017-11-18T04:40:06.460969+00:00 app[web.1]: Processing by SessionsController#new as HTML
2017-11-18T04:40:06.462953+00:00 app[web.1]: Rendered sessions/new.html.haml within layouts/application (1.1ms)
2017-11-18T04:40:06.464328+00:00 app[web.1]: Completed 200 OK in 3ms (Views: 2.7ms | ActiveRecord: 0.0ms)
2017-11-18T04:40:06.465391+00:00 heroku[router]: at=info method=GET path="/login" host=tranquil-plateau-41839.herokuapp.com request_id=e079f0c1-4408-4c29-b4a0-0707004e02fc fwd="173.28.213.164" dyno=web.1 connect=0ms service=10ms status=200 bytes=2823 protocol=http
2017-11-18T04:40:06.397638+00:00 heroku[router]: at=info method=POST path="/users" host=tranquil-plateau-41839.herokuapp.com request_id=f851ddf6-d55a-43b9-9631-a17e98fa47a4 fwd="173.28.213.164" dyno=web.1 connect=0ms service=147ms status=302 bytes=1064 protocol=http
그것은 오류를 포기하지 않는 것, 내가 내 SendGrid 사이트에서 볼 때 어떠한 활동도하지 요청 또는 반송이없는 -logs. 그래서 나는 내 구성에 문제가 있다고 가정합니다.
도움이된다면 큰 도움이 될 것입니다.
******이 지금 내 production.rb 파일
config.action_mailer.default_url_options = { host: "http://tranquil-plateau-
41839.herokuapp.com" }
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default :charset => "utf-8"
config.force_ssl = true
config.action_mailer.smtp_settings = {
:address => 'smtp.sendgrid.net',
:port => 587,
:domain => 'heroku.com',
:user_name => 'app***@heroku.com',
:password => 'secret',
:authentication => :plain,
:enable_starttls_auto => true
}
입니다 *******
업데이트이 내 development.rb 파일입니다
config.action_mailer.delivery_method = :smtp
config.action_mailer.default_url_options = { host:'localhost', port: '3000'}
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default :charset => "utf-8"
config.action_mailer.smtp_settings = {
:address => "smtp.sendgrid.net",
:port => 2525,
:domain => 'localhost:3000',
:user_name => 'app****@heroku.com',
:password => 'secret',
:authentication => :plain,
:enable_starttls_auto => true
}
프로덕션에서 문제가되는 도메인 또는 포트라는 강한 느낌이 들었습니다. 그러나 개발 중에는 이메일이 성공적으로 통과됩니다. 백만 가지의 변형을 시도해 봤는데 그걸 알아내는 것만으로는 부족합니다.
더 많은 정보가 필요하면 알려주세요. – Stockster
'user_name'과'password'는 여러분의 Sendgrid 사용자 이름과 패스워드 여야합니다. 저장소를 개인용으로 설정하지 않으면 다른 사람이 볼 수 있기 때문에 하드 코드하지 않고 환경 변수로 설정해야합니다. 오류 메시지가 표시되지 않으면 아마도 메시지가 배달되지 않은 것일 수 있으므로 user.rb 파일을 확인합니다. – domi91c
내 문제는 내가 개발 환경에있을 때 전자 메일을 보낼 수 있다는 것인데, 내가 heroku로 보내면 보내지 않을 것이다. 나는 도메인/항구 정보와 관련이 있다는 것을 매우 잘 알고 있거나 최소한 atleast하지만 내 인생에 대해서는 알 수 없다. – Stockster