However something doesn't look well...
I send you some screen shots. First of all, connections with database on localhost must work without any problems. I agree with you sending mails will be impossible at localhost but however in another scripts after adding some parameters of SMTP I can send and receive e-mails superb.
Need I explain the screen shots? The sequence of numbers of files is very important.