Rails 指定 SMTP 邮件服务器端口

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

require 'net/smtp'

message = <<MESSAGE_END
From: Private Person <me@privacy.net>
To: Author of Beginning Ruby <test@rubyinside.com>
Subject: SMTP e-mail test

This is a test e-mail message.
MESSAGE_END

Net::SMTP.start('mail.your-domain.com', 25, 'localhost', 'username', 'password', :plain)
 do |smtp|
  smtp.send_message message, 'me@privacy.net', 'test@r.com'
end