- require 'rubygems'
- require 'mail'
- smtp = { :address => 'smtp.163.com', :port => 25, :domain => '163.com', :user_name => '18703609654', :password => '****', :enable_starttls_auto => true, :openssl_verify_mode => 'none' }
- Mail.defaults { delivery_method :smtp, smtp }
- mail = Mail.new do
- from '18703609654@163.com'
- to '945627077@qq.com'
- subject 'test'
- body 'body'
- end
- mail.deliver!
- #该片段来自于http://www.codesnippet.cn/detail/230520133517.html
来源: http://www.codesnippet.cn/detail/230520133517.html