我正在尝试使用RestClient和邮件枪发送邮件。
我在我的rails应用程序中安装了gem,并在配置/应用程序.rb中定义了“需要'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!"我已经创建了与邮件枪帐户,并使用上述关键字和网址在我的帐户中提到。
当我运行代码时,它给出错误:
RestClient::ResourceNotFound (404 Resource Not Found):有谁能告诉我这里出了什么问题吗?
发布于 2014-01-09 03:58:11
您必须将此部分的"samples.mailgun.org“更改为您的帐户信息中列出的域名,有邮件枪子域名和自定义域。
假设您有一个名为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!"您的api密钥是mailgun的密码,您不应将其公开。
https://stackoverflow.com/questions/17503191
复制相似问题