after_create :send_welcome_mail
def send_welcome_mail
UserMailer.delay.welcome(self.id)
end
根据这个代码,create 成功会发出邮件,我看到 log 里面也 render 了 welcome 的 layout。 但是就是收不到。
我保证 sendmail 是好用的。
➜ ruby-china git:(master) bundle exec sidekiq -c config/sidekiq.yml
2012-10-11T09:19:09Z 14308 TID-i000c INFO: Booting sidekiq 1.1.0 with Redis at 127.0.0.1:6379
2012-10-11T09:19:09Z 14308 TID-i000c INFO: Running in ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
2012-10-11T09:19:09Z 14308 TID-31ass INFO: Starting processing, hit Ctrl-C to stop
create 也成功了:
Started POST "/account" for 192.168.1.248 at 2012-10-11 17:20:29 +0800
Processing by AccountController#create as HTML
Parameters: {"utf8"=>"✓", "authenticity_token"=>"[FILTERED]", "user"=>{"login"=>"lihuazhang", "name"=>"lihuazhang", "email"=>"[email protected]", "email_public"=>"1", "password"=>"[FILTERED]", "password_confirmation"=>"[FILTERED]"}, "commit"=>"提交注册信息"}
Redirected to http://192.168.1.197:3000/
Completed 302 Found in 160ms
还是收不到邮件。