Hi I am going crazy trying to send an email using XAMPP, my php form on my localhost server.

This is the email section of the code

PHP Code:
ini_set('sendmail_path''localhost\C:\Program Files\xampp\sendmail\sendmail.exe');$to $_REQUEST['email'];
$message "Please fill out a survey form. Follow this link---> <a href='{$email_link}'>HERE</a> to load the form.<br>";
$nameTo "Dear User"
$subject "Form completion required!";
$headers "MIME-Version: 1.0" '\r\n';
$headers .= "Content-type: text/html; charset=iso-8859-1" '\r\n';
$headers .= "From: myemail@gmail.com" '\r\n';

$sent mail($to$subject$message$headers) ; 
"Your mail was sent successfully"; }
"We encountered an error sending your mail";

Right now, I am trying to use gmail's SMTP server. And it gives the following error:

Warning: mail() [function.mail]: Failed to connect to mailserver at "ssl://smtp.gmail.com" port 465, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\survey.php on line 328

I modified the sendmail.ini and entered my username and password in the auth_username and auth_password fields and restarted XAMPP. No result.

Earlier I tried sending using my company's ISP server. But it says Client is not authenticated.

I printed phpinfo() to check whats wrong. Its using the same php.ini file I am modifying and the local values of SMTP and smtp_port are changing but not the master values.

Mercury is running in my XAMPP Control Panel. Do I need to setup mercury? I just can't figure this out. I really hope someone can help me sort this out ASAP. Much appreciated.