2013-06-19 7 views
2

조랑말 작업에 문제가 있습니다. 지금까지 메소드 호출을 여기 SMTP와 Pony.rb를 사용하고Ruby Pony 이메일 ssl 문제

TypeError: wrong argument (NilClass)! (Expected kind of OpenSSL::SSL:SSLContext)

됩니다 : 지금은 오류를 얻고 나는 문서와 SMTP를 통해 검색 한

class Email 
    def send_email 
      Pony.mail({ 
        :to => '[email protected]', 
        :via => :smtp, 
        :via_options => { 
         :address => 'smtp.macpractice.com', 
         :port => '587', 
         :enable_starttls_auto => true, 
         :user_name => '[email protected]', 
         :password => 'password', 
         :authentication => :plain, 
         :domain => "localhost.localdomain" 
        } 
      }) 
    end 
end 

. 무슨 일이 벌어지는 지 알아 내려면 rb 파일을 사용해야하지만 어떻게 든 SSLContext 객체가 전달되지 않고 포니 (Pony)에서 그렇게하는 방법을 모르겠습니다.

답변

3

답변을 알아 냈습니다. 너무처럼 SSL 검증을 해제했다 :

require 'pony' 
class Email 
    def send_email 
      Pony.mail({ 
        :to => '[email protected]', 
        :from => '[email protected]', 
        :subject => 'test', 
        :body => "yo dude", 
        :via => :smtp,  
        :via_options => { 
          :address  => 'smtp.macpractice.com', 
          :port   => '10040', 
          :user_name  => 'blaine', 
          :password  => '', 
          :authentication => :cram_md5, 
          :domain   => "localhost.localdomain", 
          :openssl_verify_mode => OpenSSL::SSL::VERIFY_NONE, 
          :enable_starttls_auto => false 

        } 
      }) 
    end 
end 

어느 것도 SSL 검증없이 SMTP 이메일을 생성하지 확인하기 위해 확인 거짓과 SSL 모드로 starttls_auto 설정.

+0

감사합니다. 나는이 "놀라운"문제로 3 시간을 보냅니다. – Stanmx

+0

예, SMTP SSL 정크를 사용하는 경우입니다. –