Bhushan Lodha
Bhushan Lodha

Reputation: 6862

Sending email: Devise, Heroku and Rails 3

1) I am not sure how this works but I have deployed my application on heroku and using devise for authentication, now I want to be able to send email from my app to user for #confirmable module. How can I do this?

I am using: Rails 3.2, Heroku and Devise for . I have bought domain name from godaddy.com if that is of any help.

2) Also, I am using google apps to manage my email on my custom domain. I followed their basic setup but I am only able to receive email on [email protected]. how to enable sending email on google apps?

Upvotes: 1

Views: 1323

Answers (1)

John Plummer
John Plummer

Reputation: 1044

Devise is already set up with the mailer and views you need to generate the mail.

You can use gmail or look at one of the transactional email providers such as Sendgrid to send the mail, they generally have a free option.

You just need to configure the SMTP settings in config/environments/production.rb.

MyApp::Application.configure do
...
end

ActionMailer::Base.smtp_settings = {
  address: "smtp.sendgrid.net",
  port: 587,
  domain: "domainname.com",
  authentication: :plain,
  user_name: ENV['SENDGRID_USERNAME'],
  password: ENV['SENDGRID_PASSWORD']
}

(While you could put this in an initialiser or environment.rb you probably only want it on production.)

Lastly add your username and password as config variables on Heroku.

Upvotes: 5

Related Questions