小编Ree*_*ool的帖子

在Ruby中尝试经过身份验证的SMTP

我查看了所有的SMTP ruby​​-docs,无法弄清楚我出错的地方:

def send(username, password, data, toAddress, fromAddress)

    smtp = Net::SMTP.new('my.smtp.host', 25)
    smtp.start('thisisunimportant', username, password, "plain") do |sender|                                                                       
        sender.send_message(data, fromAddress, toAddress)
    end

end

send(user, pass, rcpt, "Hey!")
Run Code Online (Sandbox Code Playgroud)

出现意外的错误:

/usr/lib/ruby/1.9.1/net/smtp.rb:725:in authenticate': wrong number of arguments (3 for 4) (ArgumentError) from /usr/lib/ruby/1.9.1/net/smtp.rb:566:indo_start'来自/usr/lib/ruby/1.9.1/net/smtp.rb:531:in start' from gmx_pop.rb:24:insend'来自gmx_pop.rb: 30:在''

我试过几次踢我的电脑,但问题仍然存在.

ruby

2
推荐指数
1
解决办法
3965
查看次数

标签 统计

ruby ×1