Some source of my config/environments/development.rb file
config.action_mailer.default_url_options = { :host => 'myapp.apne1.nitrousbox.com' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.default :charset => "utf-8"
config.action_mailer.smtp_settings = {
address: "smtp.mandrillapp.com",
port: 25,
domain: 'http://myapp.apne1.nitrousbox.com',
authentication: "plain",
enable_starttls_auto: true,
user_name: ENV["MANDRILL_USERNAME"],
password: ENV["MANDRILL_API_KEY"]
}
The mail can send successfully.But the password reset link url likes:
https://users/password/edit?reset_password_token=XXXXXXXXXXXXXXXXXX
The host url myapp.apne1.nitrousbox.com
disappeared! And http
became https
.
I had search the internet and find someone has the same issue.Somebody have lucky and their settings worked.I have tried that but the same result.
Error log:
ActionView::Template::Error (Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true):
4.1.0
3.4.0
AD2014-11-02 00:00:00
The password reset link(as devise's default):
<%= link_to 'Change password', edit_password_path(@resource, reset_password_token: @token) %>
Put:
Rails.application.routes.default_url_options[:host] = "myapp.apne1.nitrousbox.com"
In your config/production.rb
file.
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.