Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 4 如何在rails中包含邮件枪API?_Ruby On Rails 4_Heroku_Heroku Api - Fatal编程技术网

Ruby on rails 4 如何在rails中包含邮件枪API?

Ruby on rails 4 如何在rails中包含邮件枪API?,ruby-on-rails-4,heroku,heroku-api,Ruby On Rails 4,Heroku,Heroku Api,我想在Rails应用程序中使用Mailgun 当我通过Heroku插件加入时,虽然我想要免费版本,但添加信用卡号码时显示错误 我查了一下,从邮枪里找到了这个密码。有人能告诉我怎么用吗 require 'mail' Mail.defaults do delivery_method :smtp, { :port => 587, :address => "smtp.mailgun.org", :user_name => "", :pa

我想在Rails应用程序中使用Mailgun

当我通过Heroku插件加入时,虽然我想要免费版本,但添加信用卡号码时显示错误

我查了一下,从邮枪里找到了这个密码。有人能告诉我怎么用吗

require 'mail'
Mail.defaults do
  delivery_method :smtp, {
    :port      => 587,
    :address   => "smtp.mailgun.org",
    :user_name => "",
    :password  => "",
  }
end

mail = Mail.deliver do
  to      'bar@example.com'
  from    'foo@YOUR_DOMAIN_NAME'
  subject 'Hello'

  text_part do
    body 'Testing some Mailgun awesomness'
  end
end
我尝试使用此选项,但它显示了一个错误-
mailgun SSL\u read:sslv3 alert bad record mac

您需要注册并获取您的SMTP
用户名
密码
,这将在邮件配置中使用