Closed christhesoul closed 10 years ago
If you were somehow able to programmatically identify the base64 substring, you could add an attachment to the email object before your EmailProcessor does its work.
Thanks @calebthompson – I was looking at this, but struggling a bit (a lot) with how to access the raw_body of the email in order to extract the base64 from it, since the base64 seems to get stripped out by the sanitizing methods in https://github.com/thoughtbot/griddler/blob/master/lib/griddler/email.rb
Sorry if I'm missing something obvious.
@christhesoul Looks like you're right. https://github.com/thoughtbot/griddler/blob/master/lib/griddler/email.rb#L92 calls force_encoding
on text
, which actually modifies the string, so raw_body
isn't actually the raw body.
I think we need to dup
that. I'll take a look at this soon if someone else doesn't beat me to it.
@iantearle I'm pretty sure this is the cause of the issue you brought up as well.
@calebthompson even if you change force_encoding this wouldn't change the fact that https://github.com/thoughtbot/griddler/blob/master/lib/griddler/email.rb#L19 is not one of attr_reader :raw_body - which will have the base64 inline image included.
@iantearle raw_body
doesn't exist except as assigned on that line. attr_reader
just means that it is accessible as an instance method.
raw_text
and raw_html
should have those in there. They're both also available as attributes on the email object.
Hi! I just came across this issue. I am trying to send inline attachments with griddler/mandrill for a Rails app. Whenever it gets processed the attachments have incorrect names. I inspected the raw_text
of the email and noticed this:
<img src="cid:1620c85e6d0d0b594a91" alt="Yzma_(2)_(2)_(1)_(3)_(2)_(1).jpg" class="" style="max-width: 100%;">
it seems like the ActionDispatch::Http::UploadedFile
created by rails is using the cid
from the img tag as the filename, instead of the alt
, which is the actual file name. Is there a reason the actual name of the uploaded file is not being used for the cid
? How is the cid
being made?
Any info would help! thanks!
Hey
Thanks for all your hard work on Griddler.
I've got it working nicely with emails and "proper" attachments, but I'm trying to get it to work with MMS messages sent to an email address.
Using pry, I can see that MMS messages have inline images that are base64 encoded in the raw_body of the params.
Has anybody got any suggestions as to how I can try to extract this encoded image and convert it to a "real" image file, that I can associate with an object in my app?
Not sure if this question belongs here or it's more for StackOverflow. Just looking for some pointers really.
Thank you Chris