I would get a two gang metal handy box, a grounded cord with a plug, and an
Wire the way others have said but wire the outlet to the load side of the
switch. Add a cover plate and now you have a timer that works with any
appliance and is up to code.