2010-12-09 28 views
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)} 
    ) 

Le fichier est illisible, déformé (la version modifiée du fichier pdf ne résout pas le problème 1.4-1.6) .. Qu'est-ce qui ne va pas ?? Mauvais mime?RUBY: erreur de pièce jointe Pony email

Répondre

1

Cela ressemble à un problème lié à l'encodage. Essayez plutôt d'utiliser File.binread.

0

le type de contenu ne doit pas être simple. Laissez poney le comprendre pour vous (multipart)