当有人填写表单时,尝试将消息发送到地址。但是我收到了错误:
Errno::ECONNREFUSED in SupportrequestsController#create
Connection refused - connect(2) for "smtp.sendgrid.net" port 587
@supportrequest = Supportrequest.new(params[:supportrequest])
if @supportrequest.save <---GETTING ERROR HERE
HydraNotifier.send_support_email(@supportrequest).deliver
flash.now[:error] = nil
redirect_to( contact_path, :notice => 'email sent')
我正在使用:
Rails 4.2.5.1
红宝石2.2.3p173
gem&#39; mail_form&#39;,&#39;〜&gt; 1.5&#39;,&#39;&gt; = 1.5.1&#39;
gem&#39; sendgrid&#39;
以下是我的SMTP设置:
config.action_mailer.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:address => "smtp.sendgrid.net",
:port => 587,
:user_name => ENV['SENDGRID_USER'],
:password => ENV['SENDGRID_PASS'],
:domain => "mydomain.com",
:authentication => :plain,
:enable_starttls_auto => true
}