I wrote a custom mailer that sends an email whenever a user receives a notification. for some reason the custom mailer works but the built in devise mailer doesn't work. I'm not able to send confirmation emails
is something missing in my configuration ?
-devise.rb:
config.mailer_sender = "[email protected]"
-setup_mail.rb:
require "development_mail_interceptor"
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => "gmail.com",
:user_name => "usename",
:password => "pass",
:authentication => "plain",
:enable_starttls_auto => true
}
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.register_interceptor(DevelopmentMailInterceptor) if Rails.env.development?
I believe that looking into
config/initializers/devise.rb
will do the trick for you:
config.mailer = "Devise::Mailer"
you can uncomment it!
This can be helpful. After r&D, the final complete text is below:
# ActionMailer Config in development/production rb file
config.action_mailer.default_url_options = { :host => 'localhost:3000' }
config.action_mailer.delivery_method = :smtp
# change to true to allow email to be sent during development
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default :charset => "utf-8"
config.action_mailer.smtp_settings = {
address: "smtp.gmail.com",
port: 587,
domain: "mail.google.com",####important
authentication: "plain",
enable_starttls_auto: true,
user_name: ENV["GMAIL_USERNAME"],
password: ENV["GMAIL_PASSWORD"]
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With