Skip to content

Parts not retrieved in Rails 5 #1344

Closed
Closed
@herbertia

Description

@herbertia

Hi,

I am currently migrating our project from Rails 4.2 to Rails 5. I have upgraded the gem mail as well from 2.6.3 to 2.7.1.
In the new version I have a few emails in multi part where the different parts are not retrieved. I read the other issues and especially the issue with utf8 characters but I don't have those characters in my email.
I am attaching the email and the output in the console for Rails 4 and Rails 5. It would be great if you can help me to see what is wrong.
Thanks. Stephanie

ruby: ruby 2.2.9p480
rails: Rails 4.2.11.1
mail: mail (2.6.3)

Loading development environment (Rails 4.2.11.1)
[1] pry(main)> email = Mail.new(File.binread('example_2132.eml'))
=> #<Mail::Message:70229835096380, Multipart: true, Headers: <Received: from mail-qk0-f169.google.com (unknown [209.85.220.169]) by ip-10-164-201-109.leadalead.com (Postfix) with ESMTP id 341B02D60E for <clm@bcc.leadalead.com>; Tue, 13 Dec 2016 16:41:16 +0000 (UTC)>, <Received: by mail-qk0-f169.google.com with SMTP id n21so122011457qka.3 for <clm@bcc.leadalead.com>; Tue, 13 Dec 2016 08:41:16 -0800 (PST)>, <Received: from [127.0.0.1] (user-160uf9m.cable.mindspring.com. [xx.xx.61.54]) by smtp.googlemail.com with ESMTPSA id 21sm29417025qkf.17.2016.12.13.xx.41.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Dec 2016 08:41:14 -0800 (PST)>, <Date: Tue, 13 Dec 2016 11:41:04 -0500>, <From: Jane Doe <jane@example.com>>, <Reply-To: jane@example.com>, <To: john.doe@example.com>, <Cc: Julia <julia@example.com>>, <Message-ID: <d289b2a6-1a13-02f7-0fdb-1af4c263cf55@example.com>>, <Subject: Drawings for example>, <Mime-Version: 1.0>, <Content-Type: multipart/mixed; boundary="------------DD1F967D2CB86E70B1E6633D">, <X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:reply-to:to:from:subject:organization:cc :message-id:date:user-agent:mime-version; bh=iastj5M3CneHKsIwrWt6fYEQzyQbcvCNEBYCvxuO5RA=; b=Ygo5sdLLl3uwjSO2uEosUXS7T0SqwSrRw6PN1QqHWUm0shsr2t06+UizFGLzpM6yd5 A4vfO9Phn7ZQ61I3mSB0ccxrodLZ17M5ns5L2NHB7tAYAwAolGV4zQNhwu6fGyXcGNMR e2Xrffz/wfVIU4TCia9uq9HvRmAVVvsoUgxPnc+30Ca4uUiFHjdMNtySpKEqqlKqcGUl IC6kXYSbu6p1+vX8+q4nk7sVfj3M4+OuBz7aLvXIcVEOYXuVI0IUoWgAyNuhpIe8ERbH +QWQHGatmfpnkffDYVXK7YzrtuqAzU6LzMD1/GFCMIO7IDSH7nV6pFXrHRJjxQJHhOSq dghg==>, <X-Gm-Message-State: AKaTC01xJgxGtMUoI2tZeswnrTJ/JuqJGOPhgENQcPk6teUJpzqs33L8RD1WQgKYtiYukA==>, <X-Received: by xx.xx.xxx.195 with SMTP id t186mr82690627qkc.218.1481647275577; Tue, 13 Dec 2016 08:41:15 -0800 (PST)>, <Organization: Example>, <User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1>, <X-Antivirus: avast! (VPS 161213-0, 12/13/2016), Outbound message>, <X-Antivirus-Status: Clean>>
[2] pry(main)> email.multipart?
=> true
[3] pry(main)> email.text_part
=> #<Mail::Part:70230083431280, Multipart: false, Headers: <Content-Type: text/plain; charset=utf-8; format=flowed>, <Content-Transfer-Encoding: 8bit>>
[4] pry(main)> email.html_part
=> #<Mail::Part:70230083419440, Multipart: false, Headers: <Content-Type: text/html; charset=utf-8>, <Content-Transfer-Encoding: 8bit>>
[5] pry(main)> email.all_parts
=> [#<Mail::Part:70230083494620, Multipart: true, Headers: <Content-Type: multipart/alternative; boundary="------------6861BAB9194160C0EC8B2BA4">>,
 #<Mail::Part:70230083431280, Multipart: false, Headers: <Content-Type: text/plain; charset=utf-8; format=flowed>, <Content-Transfer-Encoding: 8bit>>,
 #<Mail::Part:70230083419440, Multipart: false, Headers: <Content-Type: text/html; charset=utf-8>, <Content-Transfer-Encoding: 8bit>>]

ruby: ruby 2.5.5p157
rails: Rails 5.2.3
mail: mail (2.7.1)

Loading development environment (Rails 5.2.3)
[1] pry(main)> email = Mail.new(File.binread('example_2132.eml'))
=> #<Mail::Message:70292628865920, Multipart: true, Headers: <Received: from mail-qk0-f169.google.com (unknown [209.85.220.169])	by ip-10-164-201-109.leadalead.com (Postfix) with ESMTP id 341B02D60E	for <clm@bcc.leadalead.com>; Tue, 13 Dec 2016 16:41:16 +0000 (UTC)>, <Received: by mail-qk0-f169.google.com with SMTP id n21so122011457qka.3        for <clm@bcc.leadalead.com>; Tue, 13 Dec 2016 08:41:16 -0800 (PST)>, <Received: from [127.0.0.1] (user-160uf9m.cable.mindspring.com. [xx.xx.61.54])        by smtp.googlemail.com with ESMTPSA id 21sm29417025qkf.17.2016.12.13.xx.41.08        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);        Tue, 13 Dec 2016 08:41:14 -0800 (PST)>, <Date: Tue, 13 Dec 2016 11:41:04 -0500>, <From: Jane Doe <jane@example.com>>, <Reply-To: jane@example.com>, <To: john.doe@example.com>, <Cc: Julia <julia@example.com>>, <Message-ID: <d289b2a6-1a13-02f7-0fdb-1af4c263cf55@example.com>>, <Subject: Drawings for example>, <Mime-Version: 1.0>, <Content-Type: multipart/mixed; boundary="------------DD1F967D2CB86E70B1E6633D">, <X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;        d=1e100.net; s=20130820;        h=x-gm-message-state:reply-to:to:from:subject:organization:cc         :message-id:date:user-agent:mime-version;        bh=iastj5M3CneHKsIwrWt6fYEQzyQbcvCNEBYCvxuO5RA=;        b=Ygo5sdLLl3uwjSO2uEosUXS7T0SqwSrRw6PN1QqHWUm0shsr2t06+UizFGLzpM6yd5         A4vfO9Phn7ZQ61I3mSB0ccxrodLZ17M5ns5L2NHB7tAYAwAolGV4zQNhwu6fGyXcGNMR         e2Xrffz/wfVIU4TCia9uq9HvRmAVVvsoUgxPnc+30Ca4uUiFHjdMNtySpKEqqlKqcGUl         IC6kXYSbu6p1+vX8+q4nk7sVfj3M4+OuBz7aLvXIcVEOYXuVI0IUoWgAyNuhpIe8ERbH         +QWQHGatmfpnkffDYVXK7YzrtuqAzU6LzMD1/GFCMIO7IDSH7nV6pFXrHRJjxQJHhOSq         dghg==>, <X-Gm-Message-State: AKaTC01xJgxGtMUoI2tZeswnrTJ/JuqJGOPhgENQcPk6teUJpzqs33L8RD1WQgKYtiYukA==>, <X-Received: by xx.xx.xxx.195 with SMTP id t186mr82690627qkc.218.1481647275577;        Tue, 13 Dec 2016 08:41:15 -0800 (PST)>, <Organization: Example>, <User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1>, <X-Antivirus: avast! (VPS 161213-0, 12/13/2016), Outbound message>, <X-Antivirus-Status: Clean>>
[2] pry(main)> email.multipart?
=> true
[3] pry(main)> email.text_part
=> nil
[4] pry(main)> email.html_part
=> nil
[5] pry(main)> email.all_parts
=> []

example_2132.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions