0

I'm using Rails 6 and Ruby 2.6. I have an issue with Action Maibox:

I'm using Maibox to receive inbound emails via Mailgun. When I'm processing an inbound email, I'm able to display it to the User with several infos (Sender name, Sender address, HTML/Plain Text versions, attachments, etc..). But I can't figure out how to display the Email weight (in kb) and the Images weight (in kb). I’d appreciate any help or tips and please let me know if you need any extra information!

  • Do you have a current implementation you could share? Have you tried displaying these sizes somehow? – Tom Lord Jun 07 '21 at 09:49
  • It seems to be more of a general mail problem than anything to do with Rails. https://stackoverflow.com/questions/7750983/calculating-the-size-of-an-email-in-net – Joel Blum Jun 07 '21 at 09:54
  • Rails gives you access to the headers and attachments but there is no sure way of accurately calculating their sizes it seems – Joel Blum Jun 07 '21 at 09:55
  • I finally found what I was looking for: `mail.raw_source.bytesize` gave me the email weight. mapping on `mail.attachments` and then `attachment.decoded.size` gave me the images weight. – Pierre Deveix Jun 08 '21 at 13:26

0 Answers0