It's probably straight-forward to do. Parse image links from the email, send those links to imgur, and replace the original image links with the imgur ones.
You also have to understand how providers deal with email to make sure delivery is never affected. We had to ensure 100% delivery and never fail.