# Unable to send a test email through my localhost



## BigLewie (Nov 22, 2013)

I was making a form to where I could email it to myself on a local host. When I run it in the browser it starts off fine. Then I submit the information and I get the following error:

*Warning: mail(): Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\contact.php*

I double checked my php code and everything is fine. I go to the php.ini file and make the SMPT = localhost and sendmail_from = (my email address ) I am using Windows Vista and Hotmail. Do you have any recommendations?


----------



## JiminSA (Dec 15, 2011)

Hi BigLewie and welcome to TSG
Unfortunately you won't be able to send mail unless you are truly server-side, as opposed to being server-side on your PC's local server (wamp/xamp whatever):down:
However for testing purposes, I normally comment out the 'mail' line and echo out the relevant email variables to get an approximation of how it will look to the receiver - viz:

```
//	mail($to, $subject, $body, $headers);
echo $to . "
" .  $subject . "
" .  $body . "
" .  $headers;
```
Hope that's sorted for you


----------



## BigLewie (Nov 22, 2013)

Thanks, JiminSA.

I'll take your advice and comment out that section. After writing my post I considered just looking for a free server for the purpose of truly testing dynamic pages.


----------

