1
 Pony.mail(:to => ad.to_s, :via => :smtp, :via_options => {
    :address              => 'smtp.gmail.com',
    :port                 => '587',
    :enable_starttls_auto => true,
    :user_name            => 'login',
    :password             => 'pass',
    :authentication       => :plain, # :plain, :login, :cram_md5, no auth by default
    :domain               => "localhost.localdomain", # the HELO domain provided by the client to the server
    :headers => { 'Content-Type' => 'text/plain' },
  },:subject => 'detail',
    :body                 => IO.read('body.txt'),
    :attachments => {"file.pdf" => File.read("./pdf/" + at.to_s)}
    )

文件不可读,变形(pdf文件的修改版本不能解决问题1.4-1.6)..怎么了?错误的 MIME 类型??

4

2 回答 2

1

看起来像编码相关的问题。尝试改用 File.binread。

于 2010-12-09T16:55:40.927 回答
0

内容类型不应该是简单的。让小马为你解决(多部分)

于 2014-04-05T03:03:41.367 回答