Actually these code for receiving attachment is not working
if email.has_attachments?
for attachment in email.attachments
page.attachments.create({
:file => attachment, :description => email.subject
})
end
So i change the code to
if email.has_attachments?
email.attachments.each do |attachment|
# save original file
File.open("C:/rubydev1/mail7/log/" +
base_part_of(attachment.original_filename)
,File::CREAT|File::TRUNC|File::WRONLY,0666){ |f|
f.write(attachment.read)
f.close()
}
end
end
And these code work fine, it did help me read the attachment file and
save it into the ruby directory. Then now i want to retrieve the email
header such as the receiver, the senter, subject and date. It is
possible. Thanks
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
On May 30, 7:59 am, Emmie Wawa <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Actually these code for receiving attachment is not working > > if email.has_attachments? > for attachment in email.attachments > page.attachments.create({ > :file => attachment, :description => email.subject > }) > endAssuming you''ve got the same models as the "other" person who posted identical code a few days ago then file is a blob column in the database and so you''d need :file => attachment.read. email is a Tmail object so it''s full of methods for reading recipients etc... Fred> > So i change the code to > > if email.has_attachments? > email.attachments.each do |attachment| > # save original file > File.open("C:/rubydev1/mail7/log/" + > base_part_of(attachment.original_filename) > ,File::CREAT|File::TRUNC|File::WRONLY,0666){ |f| > f.write(attachment.read) > f.close() > } > end > end > > And these code work fine, it did help me read the attachment file and > save it into the ruby directory. Then now i want to retrieve the email > header such as the receiver, the senter, subject and date. It is > possible. Thanks > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi I tried to send mail from application and succeed ..Since I am new to this I have a doubt to be cleared regarding this..Should I generate one action mailer (ruby script/generate mailer name)for the whole application or can I generate differnrt ones?Which is the correct method? Thanks in advance Sijo -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
You can generate several ActionMailers. It may depend on your app what''s the best way to organize them. In most cases we use only one, but having more may help to structure your code. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Thanks for your reply Sijo -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---