Change to the Encode method so that email can be sent by a console application.

So that email can be sent in console application.