Ruby on rails 3.2 RestClient::ResourceNotFound(404未找到资源):

Ruby on rails 3.2 RestClient::ResourceNotFound(404未找到资源):,ruby-on-rails-3.2,rest-client,mailgun,Ruby On Rails 3.2,Rest Client,Mailgun,我正在尝试使用RestClient和mailgun发送邮件 我在rails应用程序中安装了gem,并在config/application.rb中定义了“require'rest_client'” 然后,为了发送邮件,我在邮件控制器中写下: RestClient.post "https://api:key-3ax6xnjp29jd6fds4gc373sgvjxteol0" "@api.mailgun.net/v2/samples.mailgun.org/messages", :from =&

我正在尝试使用RestClient和mailgun发送邮件

我在rails应用程序中安装了gem,并在config/application.rb中定义了“require'rest_client'”

然后,为了发送邮件,我在邮件控制器中写下:

 RestClient.post "https://api:key-3ax6xnjp29jd6fds4gc373sgvjxteol0" "@api.mailgun.net/v2/samples.mailgun.org/messages",  :from => "Excited User <me@samples.mailgun.org>",  :to => "sergeyo@profista.com, serobnic@mail.ru",  :subject => "Hello",  :text => "Testing some Mailgun awesomness!"

谁能帮帮我这里出了什么问题

您必须将此部分“samples.mailgun.org”更改为您帐户信息中列出的域,有mailgun子域和自定义域

假设您有一个名为sandbox0000.mailgun.org的子域

#i prefer to join the strings

url = "https://api:key-3ax6xnjp29jd6fds4gc373sgvjxteol0@api.mailgun.net/v2/sandbox0000.mailgun.org/messages"

RestClient.post url,  :from => "Excited User <me@samples.mailgun.org>",  :to =>    "sergeyo@profista.com, serobnic@mail.ru",  :subject => "Hello",  :text => "Testing some Mailgun awesomness!"
#我更喜欢加入字符串
url=”https://api:key-3ax6xnjp29jd6fds4gc373sgvjxteol0@api.mailgun.net/v2/sandbox0000.mailgun.org/messages”
RestClient.post url,:from=>“兴奋用户”,“to=>”sergeyo@profista.com, serobnic@mail.ru,:subject=>“您好,:text=>“正在测试一些邮枪的威力!”
您的api密钥是mailgun的密码,您不应该将其公开

#i prefer to join the strings

url = "https://api:key-3ax6xnjp29jd6fds4gc373sgvjxteol0@api.mailgun.net/v2/sandbox0000.mailgun.org/messages"

RestClient.post url,  :from => "Excited User <me@samples.mailgun.org>",  :to =>    "sergeyo@profista.com, serobnic@mail.ru",  :subject => "Hello",  :text => "Testing some Mailgun awesomness!"