2010-06-03 40 views
0

我試圖從紅寶石發送電子郵件,但我得到一個錯誤消息。 我有這樣的代碼:紅寶石 - 發送電子郵件示例代碼問題

require 'net/smtp' 

message = <<MESSAGE_END 
From: Private Person <[email protected]> 
To: A Test User <[email protected]> 
Subject: SMTP e-mail test 

This is a test e-mail message. 
MESSAGE_END 

Net::SMTP.start('smtp.test.net', 25, 'test.com', 'usr', 'pwd', :login) do |smtp| 

    smtp.send_message message, '[email protected]',  '[email protected]' 
end 

錯誤味精: C:/ Archivos德programa/BitNami管理平臺堆棧/紅寶石/ lib中/紅寶石/ 1.8 /網/ smtp.rb:948:在check_auth_continue': 502 unimplemented (#5.5.1) (Net::SMTPSyntaxError) from C:/Archivos de programa/BitNami Redmine Stack/ruby/lib/ruby/1.8/net /smtp.rb:740:in auth_login 從C:/ Archivos德programa/BitNami管理平臺堆棧/紅寶石/ lib中/紅寶石/ 1.8 /淨 /smtp.rb:921:in'關鍵」

感謝

回答

1

除非你絕對需要手動談SMTP,我會使用ActionMailer(來自Rails)或Pony。他們提供非常簡單的界面併爲您處理STMP。