Skip to content

Instantly share code, notes, and snippets.

@AHEADer
Created Jul 21, 2017
Embed
What would you like to do?
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