2014-09-09 2 views
6

내 대학의 학생 조직에 대한 전자 메일 목록을 작성하고 있습니다. 조직에는 약 6000 명의 회원이 있으며 비용을 피하기 위해 학교 이메일 서버 사용 권한을 받았으며 나를 위해 계정을 만들었습니다.레일 4 Net :: SMTPAuthenticationError : 535 # 5.7.0 인증 실패

나는 나의 메일 클라이언트와 모든 것이 잘 작동하는 것 같군 사용하여 계정을 테스트했습니다,하지만 난 내 Rails 4 응용 프로그램을 통해 보내려고 할 때 나는 오류 얻을 :

Net::SMTPAuthenticationError: 535 #5.7.0 Authentication failed 

나는 그것과 같이 구성한를 :

application.rb

config.action_mailer.smtp_settings = 
{ 
    :address => "smtp.school.edu", 
    :port  => 25, 
    :enable_starttls_auto => true, 
    :user_name => "[email protected]", 
    :password => "mypassword", 
    :authentication => 'login', 
    :domain => 'http://myapp.herokuapp.com/' 
} 

는 다시 자격 증명은 모두 올바른지, 나는 teste이 내 메일 클라이언트를 통해 서버 관리자와 함께 앉아서 포트 및 자격 증명까지 모든 구성이 올바른지 확인합니다.

저는 smtp 서버가 "공개적으로 개방되어 있습니다"라고 말했고 아무런 연결을 차단하지 못하고 로그를 확인한 후 내 응용 프로그램에서 연결 시도를 보지 못했습니다.

누구나 여기서 어떤 문제가 발생하는지 알 수 있습니까? 거기에 대해 모르겠다는 설정이 있습니까?

+0

메일을 보낸 후 작업에서 로그를 게시 할 수 있습니까? –

+0

또한 스팸 폴더를 계속 확인하면서 특정 기능 시간을 테스트하고 다시 Google에서 스팸으로 처리합니다. –

+0

@CaffeineCoder Google을 사용하고 있지 않습니다. – Deekor

답변

1

"도메인 :"이 "herokuapp.com"대신 "school.edu"를 가리켜 야합니까?

config.action_mailer.smtp_settings = { 
    :address    => 'smtp.gmail.com', 
    :port     => 587, 
    :domain    => 'gmail.com', 
    :user_name   => '[email protected]', 
    :password    => 'example_password', 
    :authentication  => 'login', 
    :enable_starttls_auto => true 
    } 
+0

hmmm은 차이를 만들지 않습니다. – Deekor

6

시도 액션 메일러 설정 openssl_verify_mode => 'none' 추가 :

config.action_mailer.smtp_settings = 
{ 
    :address => "smtp.school.edu", 
    :port  => 25, 
    :enable_starttls_auto => true, 
    :user_name => "[email protected]", 
    :password => "mypassword", 
    :authentication => 'login', 
    :domain => 'http://myapp.herokuapp.com/', 
    :openssl_verify_mode => 'none' 
} 

, 우리는 레일 (3)을 사용하는 허가를,하지만 당신은 action_mailer 설정을 통해 Gmail에 SMTP를 설정하면 내가 알고, 당신은 같은 것을 가지고 나를 위해 일했다. 우리 문제는 인증서에 자체 서명이되어 있고 레일즈 라이브러리에서 문제가 있다고 생각한다는 것입니다. 여기에 옵션에 대해 이야기하는 article이 있습니다.

+0

제안에 감사드립니다. 불행히도 나는 여전히 같은 오류 메시지가 나타납니다. – Deekor

+1

telnet 등을 사용하여 smtp 서버에 연결을 시도 했습니까? 그게 내 구성에 무엇이 잘못되었는지를 알아 낸 것입니다 ... – user3334690

+0

예, 효과가있었습니다. – Deekor

1

도메인에 "http : //"가 있어야합니까?

+0

도메인은 서버 관리자 – Deekor

1

코드를 폴더 config/initializers/에있는 파일 setup_mail.rb을 만들고 넣어 : -

ActionMailer::Base.delivery_method = :smtp 
ActionMailer::Base.perform_deliveries = true 
ActionMailer::Base.smtp_settings = { 
    :address => "smtp.school.edu", 
    :domain => 'myapp.herokuapp.com', 
    :port  => 25, 
    :user_name => "[email protected]", 
    :password => "mypassword", 
    :authentication => :plain, 
    :enable_starttls_auto => true 
} 
ActionMailer::Base.default_url_options[:host] = "myapp.herokuapp.com" 
+0

에 따라 중요합니다. 내가하는 일과 다른 점은 무엇입니까? – Deekor

0

내 문제는 단계에 따라 해결되었습니다.

config.action_mailer.default :charset => "utf-8" 
config.action_mailer.perform_deliveries = true 
config.action_mailer.raise_delivery_errors = true 
config.action_mailer.delivery_method = :smtp 
config.action_mailer.smtp_settings = { 
    address: 'smtp.gmail.com', 
    port: 587, 
    domain: 'mysite.com', 
    user_name: [email protected], 
    password: mypassword, 
    authentication: 'plain', 
    enable_starttls_auto: true 
} 

계정 설정에서 덜 안전한 앱에 대한 액세스를 사용 중지 한 경우 google이 로그인을 차단하려고하므로. 따라서 안전성이 낮은 앱을 사용하려면 link과 함께을 사용 설정하고 ''을 사용하십시오.

관련 문제