【问题标题】:Ruby - Sending email example code problemRuby - 发送电子邮件示例代码问题
【发布时间】:2010-06-04 04:23:54
【问题描述】:

我正在尝试从 ruby​​ 发送电子邮件,但收到错误消息。 我有这个代码:

    require 'net/smtp'

message = <<MESSAGE_END
From: Private Person <test@test.net>
To: A Test User <test@test.net>
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, 'test@test.net',     'test@test.net'
end

错误信息是: C:/Archivos de programa/BitNami Redmine Stack/ruby/lib/ruby/1.8/net/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:inauth_login' 来自 C:/Archivos de programa/BitNami Redmine Stack/ruby/lib/ruby/1.8/net /smtp.rb:921:in `critical'

谢谢

【问题讨论】:

    标签: ruby email


    【解决方案1】:

    除非您绝对需要手动使用 SMTP,否则我会使用 ActionMailer(来自 Rails)或 Pony。它们提供非常简单的接口并为您处理 STMP。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-01-02
      • 1970-01-01
      • 1970-01-01
      • 2012-01-06
      • 1970-01-01
      • 2016-08-12
      • 2013-04-05
      • 2015-10-16
      相关资源
      最近更新 更多