Rails 2.3.11
我正在尝试在用户注册时发送激活式电子邮件。电子邮件已成功发送,但具有错误的“发件人”电子邮件地址。主题,内容和收件人的电子邮件都很好。它们不是从 activation @ [domain] .net 发送的,而是来自 [login-name] @ box570.bluehost.com 。
/app/models/franklin.rb:
class Franklin < ActionMailer::Base
def activation(user)
recipients user.email
from "activation@[sub].[domain].net"
subject "[Product] Registration"
body :user => user
end
end
调用它的控制器的适用部分:
@user = User.create(
:first_name => params[:first_name],
:last_name => params[:last_name],
:email => params[:email],
:password => params[:password],
:password_confirmation => params[:password_confirmation],
:user_class => "User"
)
Franklin.deliver_activation(@user)
/config/environments/development.rb:
# Settings specified here will take precedence over those in config/environment.rb
# In the development environment your application's code is reloaded on
# every request. This slows down response time but is perfect for development
# since you don't have to restart the webserver when you make code changes.
config.cache_classes = false
# Log error messages when you accidentally call methods on nil.
config.whiny_nils = true
# Show full error reports and disable caching
config.action_controller.consider_all_requests_local = true
config.action_view.debug_rjs = true
config.action_controller.perform_caching = false
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :sendmail
谢谢!
答案 0 :(得分:0)
这看起来像是特定于Bluehost的问题。您可能需要确保activation@[sub].[domain].net
电子邮件地址实际上已设置为Bluehost的完整电子邮件帐户(这似乎是一种常见的解决方案)。