I do not understand why you could not. In the mailing documentation you can see this sample code:
mail = Mail.new do from ' me@test.lindsaar.net ' to ' you@test.lindsaar.net ' subject 'Here is the image you wanted' body File.read('body.txt') add_file :filename => 'somefile.png', :content => File.read('/somefile.png') end mail.deliver!
You just need to replace the target :content => ... with the contents of your file in memory. And that should be enough. There is no real need to have attached files saved, even temporarily, to disk, as they are re-encoded in base64 and added at the end of your mail.
In the second part of your question there are many graphical / graphical libraries. See this question or this lib for example.
In fact, in fact there is no one libra over the others. There are many libs for many different uses, and you need to choose what suits your needs and your limitations best.
Coren source share