だから私は Ruby gem をテストしてい'Mail'
ます。以下は私のコードです。システム管理者によると、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 'server@company.com'
to 'cvu@company.com'
subject 'This is a test email'
body File.read('test.txt')
end
mail.to_s