Updated to support new action API.
Added callback support for sending mail.