Ruby Mail gem,如何编写邮件消息脚本

Ruby Mail gem,如何编写邮件消息脚本,ruby,email,smtp,centos5,Ruby,Email,Smtp,Centos5,我在CENTOS 5虚拟机上安装了testmail.rb,SELinux许可和IPtables关闭: require 'rubygems' require 'mail' options = { :address => "mail.domain.com", :port => 466, :domain => 'otherdomain.com',

我在CENTOS 5虚拟机上安装了testmail.rb,SELinux许可和IPtables关闭:

require 'rubygems'
require 'mail'

options = { :address              => "mail.domain.com",
            :port                 => 466,
            :domain               => 'otherdomain.com',
            :user_name            => 'somedude@domain.com',
            :password             => 'topsecret',
            :authentication       => 'plain',
            :enable_starttls_auto => true  }
 Mail.defaults do
  delivery_method :smtp, options
end

 mail = Mail.new do
      from 'somedude@otherdomain.com'
        to 'admin@domain.com'
   subject 'This is a test email'
      body File.read('body.txt')
 end

puts mail.to_s
运行脚本时的结果如下:

Date: Tue, 30 Nov 2010 12:12:58 -0500
From: somedude@otherdomain.com
To: admin@domain.com
Message-ID: <4cf5309a2f074_284015c5c4de91b8270b2@apvdbs03.3rdomain.local.mail>
Subject: This is a test email
Mime-Version: 1.0
Content-Type: text/plain;
 charset=UTF-8
Content-Transfer-Encoding: 7bit

test!
日期:2010年11月30日星期二12:12:58-0500
发件人:somedude@otherdomain.com
致:admin@domain.com
消息ID:
主题:这是一封测试邮件
Mime版本:1.0
内容类型:文本/纯文本;
字符集=UTF-8
内容传输编码:7bit
测试!
“test!”是body.txt的内容

没有电子邮件到达“发送到”帐户。我们从域管理员处获得的smtp设置已发送到域管理员。我使用telnet在未加密端口(25)上成功地向域发送电子邮件,但没有收到来自加密端口(466)的响应,可能是因为我的telnet会话未加密

我可以通过哪些方式查看脚本执行过程中发生的问题以进行故障排除

更新:
尝试重定向:>log.log 2>&1,但未提供任何其他信息。

您缺少实际发送的行。尝试添加

mail.deliver!
到你的脚本的结尾