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 に答える