閱讀623 返回首頁    go 阿裏雲 go 技術社區[雲棲]


SMTP之Ruby調用示例__SMTP接口說明_郵件推送-阿裏雲

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

require 'mail'

Mail.defaults do
  delivery_method :smtp, {
    :port      => 25,
    :address   => "smtpdm.aliyun.com",
    :user_name => "domaintest@dm.aliyun.com",
    :password  => "****",
    :enable_starttls_auto => false, 
    :openssl_verify_mode => 'none',
  }
end

mail = Mail.deliver do
  to      'test@test.com'
  from    'domaintest@dm.aliyun.com'
  subject 'Hello'

  text_part do
    body 'Testing mail'
  end
end

注:請在 :user_name => 後替換您的郵件推送地址;:password => 後替換您的郵件推送密碼;to '後替換接收地址;from '後替換郵件推送地址

最後更新:2016-11-24 11:23:48

  上一篇:go SMTP之perl調用示例__SMTP接口說明_郵件推送-阿裏雲
  下一篇:go SMTP之nodejs調用示例__SMTP接口說明_郵件推送-阿裏雲