I am using the Devise gem and I have an initializer to setup mail as below:
ActionMailer::Base.smtp_settings = {
:enable_starttls_auto => true,
:address => 'smtp.gmail.com',
:port => 587,
:domain => 'mydomain.com',
:authentication => 'plain',
:user_name => 'info@mydomain.com',
:password => 'password'
}
In devise.rb I have also set the following:
config.mailer_sender = "info@mydomain.com"
The problem I have is that when I try sent the "Forgot your password" email. My application does send the email but the link to allow me to reset the email contains the gmail domain, as follows:
http://gmail.com/users/password/edit?reset_password_token=JDKdSyhtDBkyq4Sgs2J3
I obviously need that domain to be my application's domain so the user can reset their password. What do I need to change?
Weird configuration, I usually simply set:
config.action_mailer.default_url_options = { :host => "example.com" }
In my production or development .rb
file
Just understood, config.mailer_sender = "info@mydomain.com"
is meant to fill in your from
field.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.