【发布时间】:2011-07-20 01:00:59
【问题描述】:
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
谢谢!
【问题讨论】:
标签: ruby-on-rails sendmail actionmailer