当我尝试使用mail 2.5.4 / rails 4.0.0 / ruby 1.9.3-p125配置发送邮件时,出现了以下错误信息:
SubscriptionMailer.send_email(Subscription.last).deliver
Subscription Load (0.6ms) SELECT `subscriptions`.* FROM `subscriptions` ORDER BY `subscriptions`.`id` DESC LIMIT 1
User Load (0.3ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 ORDER BY `users`.`id` ASC LIMIT 1
Rendered subscription_mailer/send_email.text.erb (0.6ms)
Rendered subscription_mailer/send_email.html.haml (5.7ms)
NoMethodError: undefined method `ascii_only?' for nil:NilClass
from /opt/blog/vendor/ruby/1.9.1/gems/mail-2.5.4/lib/mail/encodings.rb:68:in `param_encode'
from /opt/blog/vendor/ruby/1.9.1/gems/mail-2.5.4/lib/mail/fields/content_type_field.rb:95:in `block in stringify'
from /opt/blog/vendor/ruby/1.9.1/gems/mail-2.5.4/lib/mail/fields/content_type_field.rb:95:in `each'
from /opt/blog/vendor/ruby/1.9.1/gems/mail-2.5.4/lib/mail/fields/content_type_field.rb:95:in `map'
from /opt/blog/vendor/ruby/1.9.1/gems/mail-2.5.4/lib/mail/fields/content_type_field.rb:95:in `stringify'
from /opt/blog/vendor/ruby/1.9.1/gems/mail-2.5.4/lib/mail/fields/content_type_field.rb:88:in `value'
from /opt/blog/vendor/ruby/1.9.1/gems/mail-2.5.4/lib/mail/fields/content_type_field.rb:28:in `parse'
from /opt/blog/vendor/ruby/1.9.1/gems/mail-2.5.4/lib/mail/fields/content_type_field.rb:24:in `initialize'
from /opt/blog/vendor/ruby/1.9.1/gems/mail-2.5.4/lib/mail/field.rb:203:in `new'
from /opt/blog/vendor/ruby/1.9.1/gems/mail-2.5.4/lib/mail/field.rb:203:in `new_field'
from /opt/blog/vendor/ruby/1.9.1/gems/mail-2.5.4/lib/mail/field.rb:192:in `create_field'
from /opt/blog/vendor/ruby/1.9.1/gems/mail-2.5.4/lib/mail/field.rb:149:in `update'
from /opt/blog/vendor/ruby/1.9.1/gems/mail-2.5.4/lib/mail/header.rb:170:in `[]='
from /opt/blog/vendor/ruby/1.9.1/gems/mail-2.5.4/lib/mail/message.rb:588:in `content_type='
from /opt/blog/vendor/ruby/1.9.1/gems/actionmailer-4.0.0/lib/action_mailer/base.rb:695:in `mail'
from /opt/blog/app/mailers/subscription_mailer.rb:19:in `send_email'
... 8 levels...
from /opt/blog/vendor/ruby/1.9.1/gems/actionmailer-4.0.0/lib/action_mailer/base.rb:497:in `initialize'
from /opt/blog/vendor/ruby/1.9.1/gems/actionmailer-4.0.0/lib/action_mailer/base.rb:480:in `new'
from /opt/blog/vendor/ruby/1.9.1/gems/actionmailer-4.0.0/lib/action_mailer/base.rb:480:in `method_missing'
from (irb):4
from /opt/blog/vendor/ruby/1.9.1/gems/railties-4.0.0/lib/rails/commands/console.rb:90:in `start'
from /opt/blog/vendor/ruby/1.9.1/gems/railties-4.0.0/lib/rails/commands/console.rb:9:in `start'
from /opt/blog/vendor/ruby/1.9.1/gems/railties-4.0.0/lib/rails/commands.rb:64:in `<top (required)>'
from /opt/blog/vendor/ruby/1.9.1/gems/railties-4.0.0/lib/rails/app_rails_loader.rb:43:in `require'
from /opt/blog/vendor/ruby/1.9.1/gems/railties-4.0.0/lib/rails/app_rails_loader.rb:43:in `block in exec_app_rails'
from /opt/blog/vendor/ruby/1.9.1/gems/railties-4.0.0/lib/rails/app_rails_loader.rb:32:in `loop'
from /opt/blog/vendor/ruby/1.9.1/gems/railties-4.0.0/lib/rails/app_rails_loader.rb:32:in `exec_app_rails'
from /opt/blog/vendor/ruby/1.9.1/gems/railties-4.0.0/lib/rails/cli.rb:6:in `<top (required)>'
from /opt/blog/vendor/ruby/1.9.1/gems/railties-4.0.0/bin/rails:9:in `require'
from /opt/blog/vendor/ruby/1.9.1/gems/railties-4.0.0/bin/rails:9:in `<top (required)>'
from bin/rails:16:in `load'
from bin/rails:16:in `<main>'1.9.1 :005 >