From lists at kikobu.com Fri Jun 6 05:02:16 2008 From: lists at kikobu.com (Morten) Date: Fri, 6 Jun 2008 11:02:16 +0200 Subject: [Tmail-talk] TMail cannot determine content type for attachment Message-ID: Hi, the first mail I wrote on this got suspended and awaits moderator approval, I'll repost here without the offending attachment - so pardon if this gets here twice. My problem is, that TMail returns nil on the content type for the mail here: http://pastie.org/210044 Loading development environment (Rails 2.0.2) >> mail = TMail::Mail.parse(IO.read("#{RAILS_ROOT}/test/fixtures/ inbound_mailer/attachment_type.eml")) => # bodyport=nil> >> mail.attachments.first => # >> mail.attachments.first.original_filename => "Picture 7.png" >> mail.attachments.first.content_type => nil >> This is not a general problem I see, any ideas what's wrong with the email (or tmail)? Thanks. Morten From lists at kikobu.com Fri Jun 6 03:45:50 2008 From: lists at kikobu.com (Morten) Date: Fri, 6 Jun 2008 09:45:50 +0200 Subject: [Tmail-talk] TMail cannot determine content type for attachment Message-ID: Hi guys, TMail returns nil on the content type for the attached mail. Loading development environment (Rails 2.0.2) >> mail = TMail::Mail.parse(IO.read("#{RAILS_ROOT}/test/fixtures/ inbound_mailer/attachment_type.eml")) => # bodyport=nil> >> mail.attachments.first => # >> mail.attachments.first.original_filename => "Picture 7.png" >> mail.attachments.first.content_type => nil >> This is not a general problem I see, any ideas what's wrong with the email (or tmail)? Thanks. Morten -------------- next part -------------- An embedded message was scrubbed... From: Wiffle Wonkle Subject: Attachment content type nil Date: Thu, 5 Jun 2008 10:53:02 -0700 Size: 106846 URL: -------------- next part -------------- From raasdnil at gmail.com Fri Jun 6 10:54:24 2008 From: raasdnil at gmail.com (Mikel Lindsaar) Date: Sat, 7 Jun 2008 00:54:24 +1000 Subject: [Tmail-talk] TMail cannot determine content type for attachment In-Reply-To: References: Message-ID: <57a815bf0806060754m4124e203td51a34bb009453f4@mail.gmail.com> On Fri, Jun 6, 2008 at 5:45 PM, Morten wrote: > Hi guys, > TMail returns nil on the content type for the attached mail. > Thanks for this. This is definately a bug. I'm a bit tied up, but I'll try and look into it soon. If you want to scratch an itch, download trunk and give it a whirl. There are two broken tests in trunk right now though. Either way, could you open a ticket on the rubyforge? tmail.rubyforge.org will get you towards the tracker :) Click on the tracker menu option. Mikel http://lindsaar.net/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From ajain101 at gmail.com Tue Jun 10 10:11:39 2008 From: ajain101 at gmail.com (Amitabh Jain) Date: Tue, 10 Jun 2008 19:41:39 +0530 Subject: [Tmail-talk] How to install tmail without building native extensions (for jruby)? Message-ID: <938d08060806100711k11a68b0awa00f6e8d4e5be9e2@mail.gmail.com> Hi! While trying to install tmail for JRuby (version 1.1.2), I got the following error: -- C:\Documents and Settings\ajain>jruby -S gem install tmail JRuby limited openssl loaded. gem install jruby-openssl for full support. http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL Bulk updating Gem source index for: http://gems.rubyforge.org/ Building native extensions. This could take a while... ERROR: Error installing tmail: ERROR: Failed to build gem native extension. C:/software/jruby-1.1.2/bin/jruby.bat extconf.rb install tmail C:/software/jruby-1.1.2/lib/ruby/1.8/mkmf.rb:7:in `C:/software/jruby-1.1.2/lib/r uby/1.8/mkmf.rb': JRuby does not support native extensions. Check wiki.jruby.org for alternatives. (NotImplementedError) from C:/software/jruby-1.1.2/lib/ruby/1.8/mkmf.rb:1:in `require' from extconf.rb:1 Gem files will remain installed in C:/software/jruby-1.1.2/lib/ruby/gems/1.8/gem s/tmail-1.2.3.1 for inspection. Results logged to C:/software/jruby-1.1.2/lib/ruby/gems/1.8/gems/tmail-1.2.3.1/e xt/tmailscanner/tmail/gem_make.out -- Normal install fails because jruby cannot build native extensions. The site says: TMail is written in Ruby and a (very) small bit of supporting C that has pure ruby replacements if you can't compile on your computer. This means TMail will work, out of the box, on any platform that can run Ruby 1.8 or Ruby 1.9.* *This is true. If I keep the tmail.rb and tmail sub-directory in the same directory as my jruby script, I am able to use tmail successfully from within jruby. I was just wondering if there is any way to install tmail on JRuby without building the native extensions? Thanks in advance. Amitabh Jain -------------- next part -------------- An HTML attachment was scrubbed... URL: From simojenki at gmail.com Tue Jun 10 17:03:49 2008 From: simojenki at gmail.com (simon jenkins) Date: Tue, 10 Jun 2008 22:03:49 +0100 Subject: [Tmail-talk] How to install tmail without building native extensions (for jruby)? In-Reply-To: <938d08060806100711k11a68b0awa00f6e8d4e5be9e2@mail.gmail.com> References: <938d08060806100711k11a68b0awa00f6e8d4e5be9e2@mail.gmail.com> Message-ID: I am experiencing the same problem. I did a bit of digging around through the TMail source and discovered that it uses RUBY_PLATFORM to determine whether to build the native extensions depending on your OS, if you are on windows it will not build them. The other way to avoid native compilation is using the ENV var 'NORUBYEXT'. Check out the file: tmail-1.2.3.1\ext\tmailscanner\tmail\extconf.rb I have tried setting this, however it does not work as the issue is JRUBY will not let you require 'mkmf' at all. TMail does this regardless of whether it is performing native compilation. Moving the require 'mkmf' into the else statement so it is only required if performing native compilation may fix the issue. You could then set the NORUBYEXT ENV var to avoid compilation under jruby. A better fix would probably be to include the RUBY_PLATFORM value of 'java' in the list of platforms not to compile for. cheers simon On Tue, Jun 10, 2008 at 3:11 PM, Amitabh Jain wrote: > Hi! > > While trying to install tmail for JRuby (version 1.1.2), I got the > following error: > > -- > C:\Documents and Settings\ajain>jruby -S gem install tmail > JRuby limited openssl loaded. gem install jruby-openssl for full support. > http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL > Bulk updating Gem source index for: http://gems.rubyforge.org/ > Building native extensions. This could take a while... > ERROR: Error installing tmail: > ERROR: Failed to build gem native extension. > > C:/software/jruby-1.1.2/bin/jruby.bat extconf.rb install tmail > C:/software/jruby-1.1.2/lib/ruby/1.8/mkmf.rb:7:in > `C:/software/jruby-1.1.2/lib/r > uby/1.8/mkmf.rb': JRuby does not support native extensions. Check > wiki.jruby.org > for alternatives. (NotImplementedError) > from C:/software/jruby-1.1.2/lib/ruby/1.8/mkmf.rb:1:in `require' > from extconf.rb:1 > > > Gem files will remain installed in > C:/software/jruby-1.1.2/lib/ruby/gems/1.8/gem > s/tmail-1.2.3.1 for inspection. > Results logged to > C:/software/jruby-1.1.2/lib/ruby/gems/1.8/gems/tmail-1.2.3.1/e > xt/tmailscanner/tmail/gem_make.out > > -- > > Normal install fails because jruby cannot build native extensions. > > The site says: > TMail is written in Ruby and a (very) small bit of supporting C that has > pure ruby replacements if you can't compile on your computer. This means > TMail will work, out of the box, on any platform that can run Ruby 1.8 or > Ruby 1.9.* > > *This is true. If I keep the tmail.rb and tmail sub-directory in the same > directory as my jruby script, I am able to use tmail successfully from > within jruby. > > I was just wondering if there is any way to install tmail on JRuby without > building the native extensions? > > Thanks in advance. > > Amitabh Jain > > _______________________________________________ > Tmail-talk mailing list > Tmail-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/tmail-talk > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From raasdnil at gmail.com Tue Jun 10 19:01:11 2008 From: raasdnil at gmail.com (Mikel Lindsaar) Date: Wed, 11 Jun 2008 09:01:11 +1000 Subject: [Tmail-talk] How to install tmail without building native extensions (for jruby)? In-Reply-To: References: <938d08060806100711k11a68b0awa00f6e8d4e5be9e2@mail.gmail.com> Message-ID: <57a815bf0806101601g92fa7dbt39e4e06d5e029114@mail.gmail.com> On 6/11/08, simon jenkins wrote: > > I did a bit of digging around through the TMail source and discovered that > it uses RUBY_PLATFORM to determine whether to build the native extensions > depending on your OS, if you are on windows it will not build them. That's right. There is a problem in getting the gem package to decide when to compile or not. I could add java to the non compile steps.... I am actually considering loosing the c code anyway, benchmarks have not really shown it to be that much faster than the Ruby code, suprisingly. I'll have a look to see if I can get this fixed for 1.2.4 Mikel -------------- next part -------------- An HTML attachment was scrubbed... URL: From simojenki at gmail.com Wed Jun 11 02:50:43 2008 From: simojenki at gmail.com (simon jenkins) Date: Wed, 11 Jun 2008 07:50:43 +0100 Subject: [Tmail-talk] How to install tmail without building native extensions (for jruby)? In-Reply-To: <57a815bf0806101601g92fa7dbt39e4e06d5e029114@mail.gmail.com> References: <938d08060806100711k11a68b0awa00f6e8d4e5be9e2@mail.gmail.com> <57a815bf0806101601g92fa7dbt39e4e06d5e029114@mail.gmail.com> Message-ID: Thanks, What sort of time frame are you looking at for 1.2.4? cheers Simon On Wed, Jun 11, 2008 at 12:01 AM, Mikel Lindsaar wrote: > On 6/11/08, simon jenkins wrote: >> >> I did a bit of digging around through the TMail source and discovered that >> it uses RUBY_PLATFORM to determine whether to build the native extensions >> depending on your OS, if you are on windows it will not build them. > > > That's right. > > There is a problem in getting the gem package to decide when to compile or > not. > > I could add java to the non compile steps.... > > I am actually considering loosing the c code anyway, benchmarks have not > really shown it to be that much faster than the Ruby code, suprisingly. > > I'll have a look to see if I can get this fixed for 1.2.4 > > Mikel > > > _______________________________________________ > Tmail-talk mailing list > Tmail-talk at rubyforge.org > http://rubyforge.org/mailman/listinfo/tmail-talk > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From ajain101 at gmail.com Wed Jun 11 04:05:34 2008 From: ajain101 at gmail.com (Amitabh Jain) Date: Wed, 11 Jun 2008 13:35:34 +0530 Subject: [Tmail-talk] How to install tmail without building native extensions (for jruby)? In-Reply-To: <57a815bf0806101601g92fa7dbt39e4e06d5e029114@mail.gmail.com> References: <938d08060806100711k11a68b0awa00f6e8d4e5be9e2@mail.gmail.com> <57a815bf0806101601g92fa7dbt39e4e06d5e029114@mail.gmail.com> Message-ID: <938d08060806110105h4eeb103aq271bf5c8e78b7a8e@mail.gmail.com> On Wed, Jun 11, 2008 at 4:31 AM, Mikel Lindsaar wrote: > On 6/11/08, simon jenkins wrote: >> >> I did a bit of digging around through the TMail source and discovered that >> it uses RUBY_PLATFORM to determine whether to build the native extensions >> depending on your OS, if you are on windows it will not build them. > > > That's right. > > There is a problem in getting the gem package to decide when to compile or > not. > > I could add java to the non compile steps.... > > I am actually considering loosing the c code anyway, benchmarks have not > really shown it to be that much faster than the Ruby code, suprisingly. > > I'll have a look to see if I can get this fixed for 1.2.4 > > Mikel > > Ok. That helps. Thanks folks! I shall fix this in my local copy for now. > Moving the require 'mkmf' into the else statement so it is only required if performing native compilation may fix the issue. > You could then set the NORUBYEXT ENV var to avoid compilation under jruby. Isn't it better to use some command line option instead of setting an environment variable for this? Cheers Amitabh -------------- next part -------------- An HTML attachment was scrubbed... URL: From raasdnil at gmail.com Wed Jun 11 04:54:42 2008 From: raasdnil at gmail.com (Mikel Lindsaar) Date: Wed, 11 Jun 2008 18:54:42 +1000 Subject: [Tmail-talk] How to install tmail without building native extensions (for jruby)? In-Reply-To: References: <938d08060806100711k11a68b0awa00f6e8d4e5be9e2@mail.gmail.com> <57a815bf0806101601g92fa7dbt39e4e06d5e029114@mail.gmail.com> Message-ID: <57a815bf0806110154o5fc44d05kbaaed3d408ce8312@mail.gmail.com> On Wed, Jun 11, 2008 at 4:50 PM, simon jenkins wrote: > What sort of time frame are you looking at for 1.2.4? > Right after I sleep :) No, there are encoding problems in trunk right now, nothing too serious, but I am trying to keep tmail working with Ruby 1.9 AND 1.8x at the same time and it is no fun. So no definite time frame yet, if anyone wants to dive into the code, let me know. Mikel -------------- next part -------------- An HTML attachment was scrubbed... URL: From Andreas.SCHLORKE at dexia.de Mon Jun 23 04:35:29 2008 From: Andreas.SCHLORKE at dexia.de (SCHLORKE AS Andreas (DKD)) Date: Mon, 23 Jun 2008 10:35:29 +0200 Subject: [Tmail-talk] Adding attachment generates no boundary Message-ID: hi together, when adding an attachment to a mail I want to send via SMTP I get the following error: C:/localapp/apps/development/ruby/lib/ruby/gems/1.8/gems/tmail-1.2.3.1/l ib/tmail/mail.rb:556:in `quote': can't convert nil into String (TypeError) This happens in method "read_multipart" and obviously when adding an attachment a boundary is not created. Now I'm a little bit puzzled if I do this wrong or if there's a problem in the Mail class. Here's my code: def setup_mail_attachments @mail = TMail::Mail.new @mail.date = Time.now @mail.from = @from @mail.to = @to @mail.subject = @subject @mail.mime_version = '1.0' @mail.set_content_type("multipart", "mixed") mailpart1 = TMail::Mail.new mailpart1.body = @body mailpart1.set_content_type("text", "plain") @mail.parts.push(mailpart1) @attachments.each do |att| if FileTest.exists?(att) fname = File.basename(att) f = File.new(att,"rb") content = f.read mailpart=TMail::Mail.new mailpart.body = Base64.encode64(content) mailpart.transfer_encoding="Base64" mailpart.set_content_type("application", "octet-stream") mailpart['Content-Disposition'] = "attachment; filename=#{fname}" @mail.parts.push(mailpart) end end end BTW: If I add the following code to method read_multipart in Mail class everything works fine: def read_multipart( src ) bound = @header['content-type'].params['boundary'] # ADDED if bound == nil bound = ::TMail.new_boundary end #END ADDED is_sep = /\A--#{Regexp.quote bound}(?:--)?[ \t]*(?:\n|\r\n|\r)/ lastbound = "--#{bound}--" ... end thanks for your help Andreas -------------- next part -------------- An HTML attachment was scrubbed... URL: From raasdnil at gmail.com Mon Jun 23 06:38:54 2008 From: raasdnil at gmail.com (Mikel Lindsaar) Date: Mon, 23 Jun 2008 20:38:54 +1000 Subject: [Tmail-talk] Adding attachment generates no boundary In-Reply-To: References: Message-ID: <57a815bf0806230338x723d703dm7dbccd163f90f92f@mail.gmail.com> Thanks Andreas > BTW: If I add the following code to method read_multipart in Mail class > everything works fine: Could you make a test case (and patch) and submit to the tracker at tmail.rubyforge.org? Regards Mikel