Send email by SendCloud
Add this line to your application's Gemfile:
gem 'send_cloud'
And then execute:
$ bundle
Or install it yourself as:
$ gem install send_cloud
#notes:
#initialize require 'lib/send_cloud' 支持json和xml两种格式,默认为xml email = SendCloud::EmailRecord.new({:api_user=>'your_name',:api_key=>'your_key',:format=>'json'})
email.list_create({:address=>'test@edm1.com'}) result:
success<create_at>2015-01-04 10:52:59</create_at>
test@edm1.com<members_count>0</members_count>email.list_get({:address=>'test@edm1.com,:start=>'',:limit=>''})
email.list_delete({:address=>'test@edm1.com'})
support add users once time email.list_member_add({:mail_list_addr=>'test@edm1.com',:member_addr=>'john.li@rccchina.com;tony.liu@rccchina.com', :name=>'john.li;tony.liu',:vars=>'{i:1};{i:2}'})# search user from list
email.list_member_get({:mail_list_addr=>'test@rccchina.com', :member_addr=>'tony.liu@rccchina.com', :start=>"", :limit=>""})
email.list_member_delete({:mail_list_addr=>'test@edm1.com',:member_addr=>'john.li@rccchina.com',:name=>'john.li'})
substitution_vars = "{'to':['john.li@rccchina.com'], 'sub' : { '%name%' : ['约翰'], '%i%' : ['1']}}" email.send_to_user({:subject => 'your subject', :template_invoke_name => 'gx_20131227', :from => 'RCCChina system@rccchina.com', :fromname => 'RCCChina', :substitution_vars => substitution_vars})
email.send_to_list({:subject => 'your subject', :template_invoke_name => 'gx_20131227', :from => 'RCCChina system@rccchina.com', :fromname => 'RCCChina', :use_maillist => true, :to => 'test@edm1.com'})
email.send_email({:subject=>'普通发送',:html=>'测试普通发送',:from=>'tony.liu@rccchina.com',:to=>'john.li@rccchina.com'})
http://sendcloud.sohu.com/doc/apiGuide.html#apiSend
- Fork it ( https://github.com/[my-github-username]/send_cloud/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request