"Unable to read data from the transport connection: net_io_connectionclosed""An established connection was aborted by the software in your host machine"

It turned out that the outgoing mails were blocked by antivirus software on my machine. To solve this, I added the Visual Studio worker process (WebDev.WebServer.exe if you're using VS integrated dev server, aspnet_wp.exe/w3wp.exe if using IIS) to the list of excluded processes in the anti-virus software. After this, mails were sent without errors.