Lui*_*eda 5 ruby heroku mailing padrino
我正在尝试通过Padrino的sendmail发送电子邮件.我做了这里指定的配置(配置和快速使用)
但是我总是在服务器日志中出现以下错误(在Heroku或localhost上):
app[web.1]: sh: Illegal option -
app[web.1]: Errno::EPIPE - Broken pipe:
Run Code Online (Sandbox Code Playgroud)
我安装了mail gem
,我正在使用Padrino 0.10.7
我正在使用这个,发送电子邮件:
post :create do
email(:from => "tony@reyes.com", :to => "john@smith.com", :subject => "Welcome!", :body=>"Body")
end
Run Code Online (Sandbox Code Playgroud)
这几乎就是我所有的......
你应该使用其中一个parter插件与Heroku一起发送邮件.
一个很好的选择是Sendgrid
heroku addons:add sendgrid:starter --app=your_app_name
然后在App类中的app.rb中的Padrino应用程序中:
set :delivery_method, :smtp => {
:address => "smtp.sendgrid.net",
:port => 587,
:domain => 'heroku.com',
:user_name => ENV['SENDGRID_USERNAME'],
:password => ENV['SENDGRID_PASSWORD'],
:authentication => :plain,
:enable_starttls_auto => true
}
Run Code Online (Sandbox Code Playgroud)
您可以将这些替换为其他外部SMTP服务器的设置,或者查看Mandrill以获取交易电子邮件.
我怀疑您看到的Errno :: EPIPE错误是它无法连接到有效的SMTP服务器,所以您的控制器代码应该没问题.
归档时间: |
|
查看次数: |
627 次 |
最近记录: |