Getting Devise 1.3.4 to send emails using Gmail in development

I am trying to configure program 1.3.4 to send email via gmail in development mode. I should mention that I am using Rails 3.0.4 and Ruby 1.9.2p136.

I tried the following in config / environment / development.rb:

config.action_mailer.raise_delivery_errors = true config.action_mailer.perform_deliveries = true config.action_mailer.default_url_options = { :host => 'mydomain.com' } ActionMailer::Base.smtp_settings = { :address => "smtp.gmail.com", :port => 587, :domain => "mydomain.com", :user_name => "info", :password => "secret", :authentication => "plain", :enable_starttls_auto => true } 

And in config / initializers / devise.rb I changed

  config.mailer_sender = " please-change-me-at-config-initializers-devise@example.com " 

For

  config.mailer_sender = " info@mydomain.com " 

Then i tried

http://yekmer.posterous.com/devise-gmail-smtp-configuration

It still does not work.

Is there a wiki page on how to get a mail server to work? I see the email in my journal and it looks great! Links work, etc. I just want to see them in my email account.


Edit

I found the answer - I used http://yekmer.posterous.com/devise-gmail-smtp-configuration - I inserted this code in config / intializers / devise.rb when I had to put it in config / environment / development. rb.

+6
source share
4 answers

Have you tried this?

 config.action_mailer.default_url_options = { :host => 'localhost:3000' } ActionMailer::Base.smtp_settings = { :address => "smtp.gmail.com", :port => 587, :domain => "gmail.com", :user_name => " myinfo@gmail.com ", :password => "secret", :authentication => "plain" # :enable_starttls_auto => true # I don't have this, but it should work anyway } 

--------- EDIT

it is sent, you may not receive it due to a spam filter, first check:

 class UserMailer < ActionMailer::Base default :from => " myinfo@gmail.com " # ... end 
+2
source

you should put this in the initializer constructor:

 # Configure the class responsible to send e-mails. config.mailer = "YourAppDeviseMailer" 

Then create a class that extends Devise :: Mailer:

 class YourAppDeviseMailer < Devise::Mailer default :from => 'your_email' def self.mailer_name "devise/mailer" end end 
+2
source

Check if the value of ActionMailer :: Base.delivery_method: smtp

0
source

I think you can change it inside config / initializers / devise.rb. I do not need a new class?

 #config/initializers/devise.rb config.mailer_sender = ' youremail@gmail.com ' 
0
source

Source: https://habr.com/ru/post/887599/


All Articles