Reputation: 111080
Anyone know why rails, places attachments at the top of the email and not the bottom?
Mac Mail, and the Iphone for example show the attachments at the top of the email and not at the bottom, which is very strange.
My user_mailer.rb looks like this:
def error_email
attachments['message.html'] = {:mime_type => 'text/html', :content => message_text }
mail(:to => @message_from, :subject => 'reason whyxxxx')
end
How can I get the attachment at the bottom of the email msg?
Thanks
Upvotes: 1
Views: 800
Reputation: 5498
You can sort the parts whichever way you want like this:
body.set_sort_order(order)
body.sort_parts!
-- where order
defaults to ['text/plain', 'text/enriched', 'text/html', 'multipart/alternative']
.
However this sorts on content type, as far as I can tell, so if your attachment has the same content type as the text part it won't make any difference.
Upvotes: 0
Reputation: 124469
I've run into this before. A quick fix is to do this in your mailer method to reverse the order of the email parts.
message = mail(:to => @message_from, :subject => 'reason whyxxxx')
message.parts.reverse!
Upvotes: 3