The solution for the first problem is to use SMTP, which won't require the escapeshellcmd() function call.
The error when you use that method is probably caused by blank space on the page. If you attach a copy of the s.php page I could look, but it appears it is an issue on line 17 of that file.