In the case of default, it is often set as {host:'localhost', port: 3000}
in config.action_mailer.default_url_options
as shown below.
development.rb
# default url
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
# mail setting
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:user_name => Rails.application.credentials.gmail[:user_name],
:password => Rails.application.credentials.gmail[:password],
:authentication => :plain,
:enable_starttls_auto => true
}
In that case, the URL sent in the verification email is http: // localhost: 3000 / users / confirmation? Confirmation_token = -XiHyA_1xCxhk846ae9G
I think it will be shaped like this.
Since the root directory was built with Docker without the 3000 port, I had to create the URL without the port number, so I changed the settings as follows.
development.rb
config.action_mailer.default_url_options = { host: 'localhost' }
Originally, the URL should not be generated in the form of http: // localhost / users / confirmation? Confirmation_token = -XiHyA_1xCxhk846ae9G
, and I was addicted to it for several hours.
It was reflected by restarting Docker.
There is always a point that I am addicted to when developing the Web, but since it often works by restarting, I would like to keep more in mind to "try restarting if I get addicted".
Recommended Posts