2010-06-03 44 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。