设立所以我测试了红宝石的宝石'Mail'
。以下是我的代码。根据系统管理员,有通过SMTP发送出无必要的认证和服务器所允许通过SMTP发送。如果这是有道理的。红宝石宝石“邮件”与SMTP
我已经使用'net/smtp'
工作正常,但我似乎无法得到此'Mail'
宝石为我工作。它不会给我任何错误,所以我不确定问题是什么。我是一个完整的红宝石小白。
#testing out mailer
require 'mail'
Mail.defaults do
delivery_method :smtp, {
:address => '10.18.34.18',
:port => '25',
:user_name => 'anonymous',
:password => 'anonymous',
:authentication => 'plain',
:enable_starttls_auto => true}
end
mail = Mail.new do
from '[email protected]'
to '[email protected]'
subject 'This is a test email'
body File.read('test.txt')
end
mail.to_s