Please check out this tutorial. Note, however, that most of today's email clients have default security settings that block active content (such as Flash animations, javascripts etc) in email messages.