2

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.

adolzi
  • 671
  • 2
  • 7
  • 15
  • 1
    Add, config.action_mailer.delivery_method = :smtp before config.action_mailer.default_url_options = {:host => 'myproject.c9.io'} Please let me know, if it did not work for you :-) Don't forget to restart the server. – Umar Khan May 22 '15 at 11:44
  • 1
    It works, thank you. But I have a question, now I get message which I sent but extra there is message from : Delivery to the following recipient failed permanently. Maybe you know what is the reason? – adolzi May 22 '15 at 12:09
  • 1
    Glad to here that. Yeah, you have sent an email to someone email address. make sure that email address actually exist. You forget to vote up my comment :-) – Umar Khan May 22 '15 at 12:13
  • 1
    Ohh, I understand now what's going on :) thank you! I'd like to upvote your comment but I haven't arrow by it – adolzi May 22 '15 at 12:27

1 Answers1

3

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  
}
Prashant4224
  • 1,551
  • 1
  • 14
  • 21