* added scopelint and correcte issues found
* corrected scopelint issue
* made updates based on Ivan's suggestions
Most were around naming conventions
Some were false positives, but I kept them since the test.Run could eventually be changed to run in parallel, which could cause a bug
Others were false positives. Added // nolint: scopelint
* Adding additional error handling to email message sending.
* Adding additional error handling to email message sending.
* Fixing issue with err being lost in the defer.
* Moving defers to be queued up earlier to ensure they get called.
* Fixed closing encoder to use defer pattern that matches the others.