smtp接口说明--使用ruby通过smtp协议发信

使用Ruby通过smtp协议发信

# install `mail` gem first: `gem install mail`

require 'mail'

Mail.defaults do
delivery_method :smtp, {
  :port      => 25,
  :address   => "smtp.bestedm.org",
  :user_name => "domaintest@info.bestedm.org",
  :password  => "****",
  :enable_starttls_auto => false, 
  :openssl_verify_mode => 'none',
}

end

mail = Mail.deliver do
 to      'test@test.com'
 from    'domaintest@info.bestedm.org'
 subject 'Hello'

text_part do
  body 'Testing mail'
 end
end

注:请在 :user_name ⇒ 后替换您的邮件推送地址;:password ⇒ 后替换您的邮件推送密码;to '后替换接收地址;from '后替换邮件推送地址

smtp接口说明--使用ruby通过smtp协议发信.txt · 最后更改: 2017/03/22 03:52 (外部编辑)