2017-05-05 4 views
0

전자 메일 용 Amazon SES 서비스를 사용하여 Rails 응용 프로그램을 전환하려고합니다. 이 앱은 Ruby 1.8.6과 Rails 2.2.2를 사용합니다.Amazon SES : 테스트 이메일을 보냈지 만 도착하지 않는다고 말했습니다.

SES 루비 1.8.6에서 지원되지 않습니다 TLS (SSL 스타일의 암호화)를 사용하는 이메일을 필요로하지만, 나는 보석 여기,이 패치를 발견했습니다

: https://github.com/seattlerb/smtp_tls

내가 테스트 해요 과 같이, 내 콘솔에서 이메일을 보내 :

options = { 
    :address => "email-smtp.eu-west-1.amazonaws.com", 
    :port => 587, 
    :user_name => "my-ses-smtp-username", 
    :password => "my-ses-smtp-password", 
    :authentication => :login 
    } 


smtp = Net::SMTP.new options[:address], options[:port] 
smtp.enable_starttls 
smtp.start Socket.gethostname, options[:user_name], options[:password], options[:authentication] do |server| 
    server.send_message "subject: hello\nblah blah\n\n", "[email protected]", "[email protected]" 
end 

"[email protected]"와 "[email protected]"모두가 SES에 대한 확인되었으며, "ourdomain.com"가 우리의 등록 된 도메인입니다 .

SES의 샌드 박스 모드에 있고 확인 이메일에 자신의 이메일 테스트 콘솔을 사용하여 일부 이메일을 보냈습니다.

SES의 통계 페이지에는 보낸 이메일 중 하나가 나열되어 있지만 아래의 타임 라인 그래프에는 실제로 6 번 배달과 1 번 반송이 있다고합니다. 어느 쪽이든 나는 뭔가를 볼 것을 기대하지만 아무것도 없다.

나는 위의 요청에 무슨 일이 일어나고 있는지 볼 순 :: SMTP로 일부 로깅을 넣어했습니다, 그리고 내 제한된 지식, OK 보입니까 : 문제는 형식으로 밝혀졌다

net/smtp.rb:672:in `check_response': res = "220 email-smtp.amazonaws.com ESMTP SimpleEmailService-2007935501 vtiBU5pQUlPZ3bAZIaZl\n", allow_continue = false 
net/smtp.rb:648:in `getok': fmt = "EHLO %s"; args = ["max-thinkpad-linux"] 
net/smtp.rb:672:in `check_response': res = "250-email-smtp.amazonaws.com\n250-8BITMIME\n250-SIZE 10485760\n250-STARTTLS\n250-AUTH PLAIN LOGIN\n250 Ok\n", allow_continue = false 
net/smtp.rb:648:in `getok': fmt = "STARTTLS"; args = [] 
net/smtp.rb:672:in `check_response': res = "220 Ready to start TLS\n", allow_continue = false 
net/smtp.rb:648:in `getok': fmt = "EHLO %s"; args = ["max-thinkpad-linux"] 
net/smtp.rb:672:in `check_response': res = "250-email-smtp.amazonaws.com\n250-8BITMIME\n250-SIZE 10485760\n250-STARTTLS\n250-AUTH PLAIN LOGIN\n250 Ok\n", allow_continue = false 
net/smtp.rb:672:in `check_response': res = "334 VXNlcm5hbWU6\n", allow_continue = true 
net/smtp.rb:672:in `check_response': res = "334 UGFzc3dvcmQ6\n", allow_continue = true 
net/smtp.rb:648:in `getok': fmt = "MAIL FROM:<%s>"; args = ["[email protected]"] 
net/smtp.rb:672:in `check_response': res = "250 Ok\n", allow_continue = false 
net/smtp.rb:648:in `getok': fmt = "RCPT TO:<%s>"; args = ["[email protected]"] 
net/smtp.rb:672:in `check_response': res = "250 Ok\n", allow_continue = false 
net/smtp.rb:672:in `check_response': res = "354 End data with <CR><LF>.<CR><LF>\n", allow_continue = true 
net/smtp.rb:672:in `check_response': res = "250 Ok 0102015bd896c863-02370584-903e-4c64-b5a0-5c5c5dcc28c6-000000\n", allow_continue = false 
net/smtp.rb:648:in `getok': fmt = "QUIT"; args = [] 
net/smtp.rb:672:in `check_response': res = "221 Bye\n", allow_continue = false 
+0

인증에 성공 했습니까? 출력에 정리 된 인증 섹션이 표시되지 않습니다. https://en.wikipedia.org/wiki/SMTP_Authentication – ddubs

+0

인증 작동 - 비밀번호를 변경하면 인증 실패 메시지가 표시됩니다. 아마도 인증 옵션이 "로그인"으로 설정되었으므로 예상했던 것과 다른 것으로 보일 수 있습니다. –

답변

0

내 "메시지"부분.

내가하고 send_message 방법으로 해결하는으로부터 전달 해요에도 불구하고, 그들은뿐만 아니라 표준 이메일 헤더와 메시지에 갈 필요가 보인다

다음 만든 다음처럼 설정이 작동 :

from = "[email protected]" 
to = "[email protected]" 

message = <<HEREDOC 
Subject: hello 
From: #{from} 
To: #{to} 

Blah Blah Blah 
HEREDOC 

smtp = Net::SMTP.new options[:address], options[:port] 
smtp.enable_starttls 
smtp.start Socket.gethostname, options[:user_name], options[:password], options[:authentication] do |server| 
    server.send_message message, from, to 
end 

궁극적으로 ActionMailer에서 사용하게 될 것이며,이 모든 것들이 나를 위해 할 것입니다. 그러나 그것은 나를 시험 삼아하는 콘솔 테스트 첫 단계였습니다.