Rails: Not receiving email from contact us form -
Rails: Not receiving email from contact us form -
i have app in hosted in heroku test if contact form work never receive email, contact model
class contact < mailform::base attribute :name, :validate => true attribute :email, :validate => /\a([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})\z/i attribute :message attribute :nickname, :captcha => true # declare e-mail headers. accepts mail service method # in actionmailer accepts. def headers { :subject => "my contact form", :to => "contact@gmail.com", :from => %("#{name}" <#{email}>) } end end
and thid production.rb file
config.action_mailer.default_url_options = { :host => 'young-river-2391.herokuapp.com' } config.action_mailer.delivery_method = :smtp config.action_mailer.perform_deliveries = true config.action_mailer.raise_delivery_errors = false config.action_mailer.default :charset => "utf-8" config.action_mailer.smtp_settings = { address: 'smtp.gmail.com', port: 587, domain: 'gmail.com', user_name: 'contact@gmail.com', password: 'mypassword', authentication: 'plain', enable_starttls_auto: true }
update: i'm getting console
2014-11-08t17:35:07.141130+00:00 app[web.1]: started post "/contacts" 105.132.166.163 @ 2014-11-08 17:35:07 +0000 2014-11-08t17:35:07.142447+00:00 app[web.1]: processing contactscontroller#create html 2014-11-08t17:35:07.142452+00:00 app[web.1]: processing contactscontroller#create html 2014-11-08t17:35:07.142497+00:00 app[web.1]: parameters: {"utf8"=>"✓", "authenticity_token"=>"t152ngjzxx9midlrs/cgsxh6lcwg3pdj0uphbnhxozw=", "contact"=>{"name"=>"name ", "email"=>"name@gmail.com", "message"=>"this message", "nickname"=>""}, "commit"=>"send message"} 2014-11-08t17:35:07.142513+00:00 app[web.1]: parameters: {"utf8"=>"✓", "authenticity_token"=>"t152ngjzxx9midlrs/cgsxh6lcwg3pdj0uphbnhxozw=", "contact"=>{"name"=>"name ", "email"=>"name@gmail.com", "message"=>"this message", "nickname"=>""}, "commit"=>"send message"} 2014-11-08t17:35:07.149561+00:00 app[web.1]: rendered vendor/bundle/ruby/2.0.0/gems/mail_form-1.5.0/lib/mail_form/views/mail_form/contact.erb (0.7ms) 2014-11-08t17:35:07.149568+00:00 app[web.1]: rendered vendor/bundle/ruby/2.0.0/gems/mail_form-1.5.0/lib/mail_form/views/mail_form/contact.erb (0.7ms) 2014-11-08t17:35:07.141175+00:00 app[web.1]: started post "/contacts" 105.132.166.163 @ 2014-11-08 17:35:07 +0000 2014-11-08t17:35:07.417088+00:00 heroku[router]: at=info method=post path="/contacts" host=young-river-2391.herokuapp.com request_id=7cabe546-1435-4626-a441-01377a668def fwd="105.132.166.163" dyno=web.1 connect=2ms service=281ms status=200 bytes=1719 2014-11-08t17:35:07.414677+00:00 app[web.1]: 2014-11-08t17:35:07.414680+00:00 app[web.1]: sent mail service contact@gmail.com (263.7ms) 2014-11-08t17:35:07.414686+00:00 app[web.1]: 2014-11-08t17:35:07.414687+00:00 app[web.1]: sent mail service contact@gmail.com (263.7ms) 2014-11-08t17:35:07.415701+00:00 app[web.1]: rendered contacts/create.html.erb within layouts/application (0.1ms) 2014-11-08t17:35:07.415706+00:00 app[web.1]: rendered contacts/create.html.erb within layouts/application (0.1ms) 2014-11-08t17:35:07.416507+00:00 app[web.1]: completed 200 ok in 274ms (views: 1.3ms | activerecord: 0.0ms) 2014-11-08t17:35:07.416512+00:00 app[web.1]: completed 200 ok in 274ms (views: 1.3ms | activerecord: 0.0ms)
did add together sendgrid or 1 of other mail service add-ons? these required send email heroku app.
see https://devcenter.heroku.com/articles/smtp
ruby-on-rails ruby-on-rails-3 email ruby-on-rails-4
Comments
Post a Comment