Skip to content

Instantly share code, notes, and snippets.

@AHEADer
Created July 21, 2017 11:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AHEADer/ea58aefbc7d4b9a097d3a3aa7decd218 to your computer and use it in GitHub Desktop.
Save AHEADer/ea58aefbc7d4b9a097d3a3aa7decd218 to your computer and use it in GitHub Desktop.
sendcloud
#!/usr/bin/env ruby
require 'rubygems'
require 'rest_client'
def send_mail
response = RestClient.post "http://api.sendcloud.net/apiv2/mail/send",
:apiUser => 'ahelp17cow_test_rSoOwt', # 使用api_user和api_key进行验证
:apiKey => '',
:from => "help@17cow.com", # 发信人,用正确邮件地址替代
:fromName => "SendCloud",
:to => "aheadwinder@qq.com", # 收件人地址,用正确邮件地址替代,多个地址用';'分隔
:subject => "SendCloud ruby webapi common example",
:html => '欢迎使用SendCloud'
return response
end
response = send_mail
puts response.code
puts response.to_str
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment