Download files from mail

Hi,

I’m trying to download a file with net::IMAP from mail count. I can
download plain texts files using fetch method and unpack’m’, but when i
try it with an excel file (vnd.ms-excel), the downloaded excel is
corrupted.

thanks for all

compare the files and detect de differences

bye

Blanca Id wrote:

Hi,

I’m trying to download a file with net::IMAP from mail count. I can
download plain texts files using fetch method and unpack’m’, but when i
try it with an excel file (vnd.ms-excel), the downloaded excel is
corrupted.

thanks for all

Hi Artur,

I have compared the excel file download from mail with the original and
seems to be the same. I’ve read that can be that the LF character has
been replaced with CRLF characters, so the download file size is
diferent.

thanks

Artur Juve wrote:

compare the files and detect de differences

bye

Hi,

At last I found the solution, to download correctly excel files I use
the ‘wb’ instead of ‘w’ on the open parameters.

if body.subtype == “PLAIN”
File.open(nameFile,‘w’)
f.write(file)
end
else
File.open(nameFile,‘wb’)
f.write(file)
end
end

bye

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs