adolzi
adolzi

Reputation: 691

Rails: Sending email after filling contact form

I'd like to create contact form using this tutorial

At the end of that is writen that I should configure SMTP, so in config/environments/developement.rb I set

 config.action_mailer.default_url_options = {:host => 'myproject.c9.io'}

(I'm using rails on c9.io)

ActionMailer::Base.smtp_settings = {
  :address              => "smtp.gmail.com",
  :port                 => 587,
  :domain               => "gmail.com",
  :user_name            => "myusername",
  :password             => "mypassword",
  :authentication       => "plain",
  :enable_starttls_auto => true
}

I'm fairly new in rails and especially in sending emails, so I'd like to ask, because I don't get message on my email address when I fill form and send, what should I do to get a confirmation of correct sending. I know that there is a lot of tutorials on the Internet but now I'm in the muddle, so I'll be grateful for explanation.

Upvotes: 2

Views: 857

Answers (1)

Prashant4224
Prashant4224

Reputation: 1601

Add these config to your development.rb reference

config.action_mailer.default_url_options = {:host => 'myproject.c9.io'}

config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  address:              'smtp.gmail.com',
  port:                 587,
  domain:               'gmail.com',
  user_name:            'myusername',
  password:             'mypassword',
  authentication:       'plain',
  enable_starttls_auto: true  
}

Upvotes: 3

Related Questions