Attachement corrupt

I'm using ActionMailer to send an e-mail with attachement, but I receive the same e-mail attachement corrupted.

How I can resolve that?

The enviroment is: - Windows - Microsoft Exchange Server.

Code Enviroment.rb:

   1. ActionMailer::Base.delivery_method = :smtp    2.    3. ActionMailer::Base.smtp_settings = {    4. :address => 'nome_do_servidor',    5. :port => 25,    6. :domain => nil    7. }

Code Method to send e-mail:    1. def enviar(mensagem)    2. @subject = mensagem.assunto    3. @body = {:mensagem => mensagem}    4. @recipients = mensagem.para    5. @from = mensagem.de    6. @sent_on = Time.now    7. @headers = {}    8.    9. unless mensagem.arquivos.blank?   10. arquivo = mensagem.arquivos   11. attachment(:filename => File.basename(arquivo)) do |a|   12. file = File.open(arquivo, 'r+') {|f| a.body = f.read}   13. end   14. end   15. end

Thanks,

Daskandonga