Created
July 21, 2017 11:53
-
-
Save AHEADer/ea58aefbc7d4b9a097d3a3aa7decd218 to your computer and use it in GitHub Desktop.
sendcloud
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 => "[email protected]", # 发信人,用正确邮件地址替代 | |
:fromName => "SendCloud", | |
:to => "[email protected]", # 收件人地址,用正确邮件地址替代,多个地址用';'分隔 | |
: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