Looking for a way to detach attachment from email at arrival

I am looking for a ruby way to receive an email with attachment,
detach the attachment, convert it to a URL, insert the url in the body
and send the email away to the recipeint.

I see the modules ActionMailer and TMail as possible module to handle
the email. But yet to find a somewhat complete solution to this core
requirement.

I am new to ruby and like some suggestion and/or direction on solving
this problem

Thanks