mail icon indicating copy to clipboard operation
mail copied to clipboard

NoMethodError when adding a file with umlauts (åäö) which has umlauts in its content

Open ba opened this issue 16 years ago • 3 comments

This is basically me trying to re-open issue #52.

I'm running the same test code with 2.2.5 and getting an error adding a file named with umlauts which contains umlauts. This last part I just noticed. My test files didn't work between the versions so I moved things around and noticed this.

I noted that if I tried to add an empty file named 'åäö.txt' the mail got sent no problems. And if the file had text in it with only 0-9 and a-z it went through without a problem. But If I added an umlaut in the content of the file Mail blew up with:

/usr/lib/ruby/gems/1.8/gems/mail-2.2.5/lib/mail/field.rb:122:in `send': undefined method `filename' for #<Mail::UnstructuredField:0xb7431cac> (NoMethodError)
    from /usr/lib/ruby/gems/1.8/gems/mail-2.2.5/lib/mail/field.rb:122:in `method_missing'
    from /usr/lib/ruby/gems/1.8/gems/mail-2.2.5/lib/mail/message.rb:1849:in `find_attachment'
    from /usr/lib/ruby/gems/1.8/gems/mail-2.2.5/lib/mail/message.rb:1706:in `attachment?'
    from /usr/lib/ruby/gems/1.8/gems/mail-2.2.5/lib/mail/message.rb:1341:in `add_charset'
    from /usr/lib/ruby/gems/1.8/gems/mail-2.2.5/lib/mail/message.rb:1781:in `add_required_fields'
    from /usr/lib/ruby/gems/1.8/gems/mail-2.2.5/lib/mail/part.rb:42:in `add_required_fields'
    from /usr/lib/ruby/gems/1.8/gems/mail-2.2.5/lib/mail/message.rb:1654:in `ready_to_send!'
    from /usr/lib/ruby/gems/1.8/gems/mail-2.2.5/lib/mail/message.rb:1652:in `ready_to_send!'
    from /usr/lib/ruby/gems/1.8/gems/mail-2.2.5/lib/mail/message.rb:1650:in `each'
    from /usr/lib/ruby/gems/1.8/gems/mail-2.2.5/lib/mail/message.rb:1650:in `ready_to_send!'
    from /usr/lib/ruby/gems/1.8/gems/mail-2.2.5/lib/mail/message.rb:1666:in `encoded'
    from /usr/lib/ruby/gems/1.8/gems/mail-2.2.5/lib/mail/network/delivery_methods/smtp.rb:91:in `deliver!'
    from /usr/lib/ruby/gems/1.8/gems/mail-2.2.5/lib/mail/message.rb:1862:in `do_delivery'
    from /usr/lib/ruby/gems/1.8/gems/mail-2.2.5/lib/mail/message.rb:225:in `deliver'
    from /usr/lib/ruby/gems/1.8/gems/mail-2.2.5/lib/mail/mail.rb:140:in `deliver'
    from /home/ba/mail-test.rb:30

A file not named with umlauts and with umlauts in the content went through without a problem.

Weird. :)

ba avatar Jun 24 '10 10:06 ba

I think you will find this is because of the content-type problem. Could you please install mail 2.2.5.1 and try again?

mikel avatar Sep 11 '10 03:09 mikel

I can confirm this bug with rails 3.0.1 and mail 2.2.7. German umlauts (maybe other special characters too) in filename result in to the "no method 'filename'" error, whenn adding an attachment. Any ideas, how to fix this?

bennibu avatar Oct 20 '10 09:10 bennibu

I made a fix with this problem: https://github.com/mikel/mail/pull/158

As I tested only in Japanese, I'm happy if you guys verify that this works properly for your languages (Swedish, German or whatever) as well.

amatsuda avatar Dec 02 '10 06:12 amatsuda