Hi all, I''ve found a bug in action mailer/tmail that''s preventing deployment of my application. Simply put: If I attach a file that''s too large (larger than 50k or so??) to a message I get a segmentation fault. Any help would be GREATLY appreciated!! I''m attaching via the following code: class TMail::Mail def add_attachment(this_filename,this_content_type,send_name = nil) justfile = File.basename(this_filename) send_name ||= justfile l_attach = TMail::Mail.new l_attach.content_disposition = ''attachment; filename="''+send_name+''"'' types = this_content_type.split(''/'') l_attach.set_content_type types[0], types[1],{"filename" => send_name} l_attach.transfer_encoding = "base64" l_attach.body = Base64.encode64 (File.read(this_filename)) if self.parts.empty? l_bodypart = TMail::Mail.new l_bodypart.set_content_type "text","plain" l_bodypart.content_disposition = "inline" l_bodypart.body = self.body self.set_content_type("multipart","mixed") self.parts[0] = l_bodypart end self.parts.push l_attach end end and I get the following error: /usr/local/lib/ruby/gems/1.8/gems/actionmailer-0.9.1/lib/action_mailer/vendor/tmail/utils.rb:30: [BUG] Segmentation fault
Just a bump for my own comment here. This ActionMailer segmentation fault is really holding up my deployment. Any help would be greatly appreciated. On Monday 06 June 2005 09:55, Luke Galea wrote:> Hi all, > > I''ve found a bug in action mailer/tmail that''s preventing deployment of my > application. Simply put: If I attach a file that''s too large (larger than > 50k or so??) to a message I get a segmentation fault. > > Any help would be GREATLY appreciated!! > > I''m attaching via the following code: > class TMail::Mail > def add_attachment(this_filename,this_content_type,send_name = nil) > justfile = File.basename(this_filename) > send_name ||= justfile > l_attach = TMail::Mail.new > l_attach.content_disposition = ''attachment; > filename="''+send_name+''"'' > types = this_content_type.split(''/'') > l_attach.set_content_type types[0], types[1],{"filename" => > send_name} l_attach.transfer_encoding = "base64" > l_attach.body = Base64.encode64 > (File.read(this_filename)) > if self.parts.empty? > l_bodypart = TMail::Mail.new > l_bodypart.set_content_type "text","plain" > l_bodypart.content_disposition = "inline" > l_bodypart.body = self.body > self.set_content_type("multipart","mixed") > self.parts[0] = l_bodypart > end > self.parts.push l_attach > end > end > > and I get the following error: > /usr/local/lib/ruby/gems/1.8/gems/actionmailer-0.9.1/lib/action_mailer/vend >or/tmail/utils.rb:30: [BUG] Segmentation fault > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
On Jun 7, 2005, at 10:30 AM, Luke Galea wrote:> Just a bump for my own comment here. > This ActionMailer segmentation fault is really holding up my > deployment. Any > help would be greatly appreciated.What version of Ruby are you using? Incidentally, the next version of Rails will make doing attachments much easier, which may simplify your implementation: def add_attachment(this_filename, this_content_type, send_name = nil) attachment this_content_type do |a| a.filename = send_name || File.basename(this_filename) a.body = File.read(this_filename) end end The rest is assumed and automatically--a base64 encoding, ''attachment'' content disposition, etc. It will also automatically build a multipart message if an attachment is added. To that end, you may want to try your app with the latest version of Rails from svn HEAD, to see if the segfault goes away. - Jamis> > On Monday 06 June 2005 09:55, Luke Galea wrote: > >> Hi all, >> >> I''ve found a bug in action mailer/tmail that''s preventing >> deployment of my >> application. Simply put: If I attach a file that''s too large >> (larger than >> 50k or so??) to a message I get a segmentation fault. >> >> Any help would be GREATLY appreciated!! >> >> I''m attaching via the following code: >> class TMail::Mail >> def add_attachment(this_filename,this_content_type,send_name = >> nil) >> justfile = File.basename >> (this_filename) >> send_name ||= justfile >> l_attach = TMail::Mail.new >> l_attach.content_disposition = ''attachment; >> filename="''+send_name+''"'' >> types = this_content_type.split >> (''/'') >> l_attach.set_content_type types[0], types[1],{"filename" => >> send_name} l_attach.transfer_encoding = "base64" >> l_attach.body = Base64.encode64 >> (File.read(this_filename)) >> if self.parts.empty? >> l_bodypart = TMail::Mail.new >> l_bodypart.set_content_type "text","plain" >> l_bodypart.content_disposition = "inline" >> l_bodypart.body = self.body >> self.set_content_type("multipart","mixed") >> self.parts[0] = l_bodypart >> end >> self.parts.push l_attach >> end >> end >> >> and I get the following error: >> /usr/local/lib/ruby/gems/1.8/gems/actionmailer-0.9.1/lib/ >> action_mailer/vend >> or/tmail/utils.rb:30: [BUG] Segmentation fault >> >> _______________________________________________ >> Rails mailing list >> Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails >> > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >