Tmail: Saving Excel attachments to disk.

  • Thread starter Andrew M. Campbell
  • Start date
A

Andrew M. Campbell

I'm using ActionMailer, which uses Tmail, to save
Excel attachments to disk. I found a tutorial for
saving attachments. However whether I decode the
message part or not. Excel says the file is corrupt.
I'm using Windows XP, latest stable Ruby and latest
Rails gem. The mails I receive are valid multipart
mail messages. The spreadsheet attachments are valid
as well. Any Suggestions on the proper way to save
Excel attachments using Tmail?

My code is very similar to this tutorial. All I do is
check the content type of each part. If it is an
Excel spreadsheet. I push it onto an array. Then
iterate over the array of spreadsheets, saving them to
disk. The code I use to write to disk is identical to
the tutorial.
http://mondragon.cc/blog/articles/2...il-attachments-with-actionmailer-base-receive

Thanks,
 
J

Jan Svitok

I'm using ActionMailer, which uses Tmail, to save
Excel attachments to disk. I found a tutorial for
saving attachments. However whether I decode the
message part or not. Excel says the file is corrupt.
I'm using Windows XP, latest stable Ruby and latest
Rails gem. The mails I receive are valid multipart
mail messages. The spreadsheet attachments are valid
as well. Any Suggestions on the proper way to save
Excel attachments using Tmail?

My code is very similar to this tutorial. All I do is
check the content type of each part. If it is an
Excel spreadsheet. I push it onto an array. Then
iterate over the array of spreadsheets, saving them to
disk. The code I use to write to disk is identical to
the tutorial.
http://mondragon.cc/blog/articles/2...il-attachments-with-actionmailer-base-receive

Thanks,

try adding "binary" to File.open() if you're on windows

you can check if this is your problem by sending a known file to
yourself and compare the sent and received files - if there's a
problem, they'd differ in length, just make sure the sent file
contains \n (13)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top