refactor code
use the restsharp to access the web API directly to send the email