我有一个带有设置的 actionmailer:
配置/初始化程序/setup_mail.rb
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:user_name => "cool@gmail.com",
:password => "cool",
:authentication => "plain",
:enable_starttls_auto => true
}
ActionMailer::Base.default_url_options[:host] = "https://pacific-ravine-3563.herokuapp.com/"
在创建用户时发送电子邮件。但是,我检查了发送的电子邮件,但链接不起作用。这是电子邮件的模板:
Dear <%= @user.name %>,
<p>
Welcome to Pholder! Get started by finding and inviting <%= link_to "friends", users_url %> so that you can exclusively upload and view pictures with each other.
</p>
<p>
<%= link_to "View profile", user_url(@user) %>
<%= link_to "Edit profile", edit_user_url(@user) %>
</p>
<p>
Sincerely, <br>
Pholder Staff
</p>
当我检查实际电子邮件时:
Dear Ellen,
Welcome to Pholder! Get started by finding and inviting friends so that you can exclusively upload and view pictures with each other.
View profile Edit profile
Sincerely,
Pholder Staff
所有链接都不起作用。应该发送给我的第一个链接将我users_url
发送到:https//pacific-ravine-3563.herokuapp.com/users
而不是。这适用于其他 2 个链接(user_url(@user)
将我发送到https//pacific-ravine-3563.herokuapp.com/users/9
等)
是因为我错误地设置了 default_url 吗?