Yes, its possible. Although I don't recommend storing the image itself in the database (performance and maintenance issues). Just store the file path.
To do this, you'll need to retrieve the email and parse it. I find Pear's Mail Mime_decode to be a great tool for doing this.