mms2r automatic downloading of remote images
I am using the awesome MMS2R gem (https://github.com/monde/mms2r) to create an app that processes mms messages sent to an email address, storing the mms media (images, video, audio) locally for my app to use.
My code is working nicely when the media is an actual attachment in the email. But I have run into a problem when the images are not "real" attachments, instead they are embedded in the html of the email and stored on a remote server.
Specifics of my gear:
- Using mms2r v3.4.1, mail (2.3.0)
- The MMS message comes from XXX@pm.sprint.com
- I'm POPing a gmail address
A simplified version of my code looks like
msgs = Mail.all msgs.each do |m| mail = MMS2R::Media.new(m) puts mail.has_attachments? puts mail.media.size end
This results in the following output for the email in question:
> false > 0
So, is there anything special that I should be doing to get at these remote attachments? I am under the impression that this is what the mms2r gem is designed for. Was I mistaken? Do I have to fetch the remote media myself?
The issue appears to be related to my use of ruby 1.9.2 and/or the version of gems installed. Will now narrow it down.
The issue turns out to be a problem with mms2r and ruby versions 1.9.x. Monde (below) is the developer of the mms2r gem and will look to fix the bug soon.
That is correct, Sprint has a content delivery service for their media instead of delivering the full payload in the actual MMS/mail body. The abstraction for this is in the module MMS2R::Media::Sprint https://github.com/monde/mms2r/blob/master/lib/mms2r/media/sprint.rb
Is the sample MMS your are working with older than about 30 days? I know that they expire content on their CDN but I'm not sure how quickly that is. I want to say that the expiry is around thirty days or so.
Update - Just double checked my live system that is consuming MMS fromt he wild, I am not seeing any issues with Sprint at this time in my system.
Update2 - This is was a problem in Ruby 1.9.X fetching content from Sprint's CDN, it has been fixed in MMS2R release 3.5.0