Probably you aren't receiving any e-mails from that code because your e-mail server (the one you sent the e-mails to) doesn't trust your program's e-mail server (the one you're sending the e-mails from). Your server will be doing something like examining the from-address on the e-mail and seeing if it came from the actual server for the from-address's domain. If it didn't, then it considers the e-mail to be a forgery.
And since the from-address is "test1@localhost", it's pretty clearly a forgery. You need to do two things: use a from-address which belongs to a domain, and send the e-mail from that domain's e-mail server.