我正在使用CloudMailin尝试通过电子邮件将个人资料图片上传到移动设备网站。使用他们的文档,我...
传入邮件控制器.rb:
def create
...
user_id = params[:headers][:subject] # line 13
...
end
我得到的错误:
NoMethodError (undefined method `[]' for nil:NilClass):
app/controllers/incoming_mails_controller.rb:13:in `create'
日志的相关部分:
Apple-Mail=_...\r\n", "x_references"=>"sample@example.com", "x_cc_header"=>"", "subject"=>"Smith, Joe"}
在网上翻遍了解决方案,没有找到解决方案。谢谢你的帮助。
更新:
在控制器中放置以下内容:
::Rails.logger.info "PARAMS INSPECT: " + params.inspect
以下只是它产生的一小部分:
PARAMS INSPECT: {"message"=>"Received: by ... :content-type:subject:date:message-id:to:mime-version:x-mailer\r\n...
Content-Type: multipart/alternative; boundary=\"Apple-Mail=_..."\r\n
Subject: Smith, John\r\n ...
"return_path"=>"yada@blah.com",
"x_from_header"=>"[\"blay@yada.com\"]", ...
"subject"=>"Smith, John"