可以在本地发送邮件,但不能在Heroku上发送

时间:2016-08-03 10:57:09

标签: ruby email heroku sinatra

我在通过Heroku发送邮件时遇到问题。我可以在本地发送它,但出于某种原因,每次我通过Heroku发送它时,我都会遇到“内部服务器错误”。它过去运行良好,但我所要做的就是更改密码,然后问题就开始了。有谁知道发生了什么?

post '/' do
    require 'pony'
    name  = params[:name]
    mail = params[:mail]
    subject = params[:subject]
    body  = params[:body]

Pony.options = {
  :via => :smtp,
  :via_options => {
    :address              => 'smtp.gmail.com',
    :location             => '/c/sendmail/./sendmail',
    :ssl                  => true,
    :arguments            => '-t',
    :port                 => '587',
    :enable_starttls_auto => true,
    :user_name            => 'username',
    :password             => "password",
    :authentication       => :plain, # :plain, :login, :cram_md5, no auth by default
    :domain               => "localhost",
    # :tls                => true
  }
}


    Pony.mail(
        :to => 'stokes8671@gmail.com', 
        :from => name + '<' + mail + '>',
        :reply_to => mail,
        :subject => subject,
        :body => body)

0 个答案:

没有答案