# PHP Form Mailer Woes

**URL:** https://forum.kirupa.com/t/php-form-mailer-woes/130847
**Category:** Uncategorized
**Created:** [December 9, 2004, 3:44am UTC](https://forum.kirupa.com/t/php-form-mailer-woes/130847 "2004-12-09T03:44:56Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![AzN](https://avatars.discourse-cdn.com/v4/letter/a/8e8cbc/32.png) [@AzN](https://forum.kirupa.com/u/AzN)
#### Post date: [December 9, 2004, 3:44am UTC](https://forum.kirupa.com/t/php-form-mailer-woes/130847/1 "2004-12-09T03:44:56Z")

</div>

First off here’s the code:

[size=1]\<?php  
$to = “[/size][[size=1]l3a0@hotmail.com[/size]](mailto:l3a0@hotmail.com)[size=1]”;  
$from = $\_POST[‘name’];  
$email = $\_POST[‘email’];  
$subject = “Online Form”;[/size]  
[size=1]$date = date (“l, F jS, Y”);  
$time = date (“h:i A”);[/size]  
[size=1]$msg = "Below is the result of your feedback form. It was submitted on $date at $time.

“;[/size]  
[size=1]foreach ($\_POST as $key =\> $value) {  
$msg .= ucfirst ($key) .” : “. $value . "  
“;  
}[/size]  
[size=1]mail( $to, $subject, $msg, “From: “.$from.”  
“.”\<”.$email.”\>”); [color=red]\<-- [line 24]  
[/color]?\>[/size]

Simple enough, but the problem comes when I click submit on the form.

Here’s the form:

[size=1]\<form action=“mailer.php” method=“post” name=“contact”\>  
\<table border=“1” bordercolor="#000000"\>  
\<tr\>  
\<td class=“TableLeft”\>Name:\</td\>  
\<td class=“TableRight”\>\<input name=“name” type=“text” size=“40”\>\</td\>  
\</tr\>  
\<tr\>  
\<td class=“TableLeft”\>Street Address:\</td\>  
\<td class=“TableRight”\>\<input name=“street” type=“text” size=“40”\>\</td\>  
\</tr\>  
\<tr\>  
\<td class=“TableLeft”\>City, State, Zip:  
\</td\>  
\<td class=“TableRight”\>\<input name=“city” type=“text” size=“40”\>  
(i.e. City, State Zip)\</td\>  
\</tr\>  
\<tr\>  
\<td class=“TableLeft”\>Telephone:\</td\>  
\<td class=“TableRight”\>\<input name=“phone” type=“text” size=“20” maxlength=“12”\> (i.e. xxx-xxx-xxxx)\</td\>  
\</tr\>  
\<tr\>  
\<td class=“TableLeft”\>Fax:\</td\>  
\<td class=“TableRight”\>\<input name=“fax” type=“text” size=“20” maxlength=“12”\>\</td\>  
\</tr\>  
\<tr\>  
\<td class=“TableLeft”\>E-mail:\</td\>  
\<td class=“TableRight”\>\<input name=“email” type=“text” size=“20”\>\</td\>  
\</tr\>  
\<tr\>  
\<td class=“TableLeft”\>Type of Loan:\</td\>  
\<td class=“TableRight”\>\<select name=“Loan”\>  
\<option selected\>Please Select\</option\>  
\<option value=“Purchase”\>Purchase\</option\>  
\<option value=“Refinance”\>Refinance\</option\>  
\<option value=“Home Equity”\>Home Equity\</option\>  
\</select\>  
Other: \<input name=“other” type=“text” size=“20”\>  
\</td\>  
\</tr\>  
\<tr\>  
\<td class=“TableLeft”\>Current Rate:\</td\>  
\<td class=“TableRight”\>\<input name=“rate” type=“text” size=“2” maxlength=“5”\> (i.e. 5.8% = 5.800)\</td\>  
\</tr\>  
\<tr\>  
\<td class=“TableLeft”\>Principal:\</td\>  
\<td class=“TableRight”\>\<input name=“principal” type=“text” size=“20”\>  
(i.e. $250,000.00 = 250000.00)\</td\>  
\</tr\>  
\<tr\>  
\<td class=“TableLeft”\>Appraised Value of Home:\</td\>  
\<td class=“TableRight”\>\<input name=“appraised” type=“text” size=“20”\>\</td\>  
\</tr\>  
\<tr\>  
\<td class=“TableLeft”\>Rate Your Credit:\</td\>  
\<td class=“TableRight”\>  
\<label\>\<input type=“radio” name=“credit” value=“excellent”\>Excellent\</label\>  
\<br\>  
\<label\>\<input type=“radio” name=“credit” value=“ok”\>OK, but some problems\</label\>  
\<br\>  
\<label\>\<input type=“radio” name=“credit” value=“bad”\>Major credit problems\</label\>  
\<br\>  
\<label\>\<input type=“radio” name=“credit” value=“dunno”\>Don’t know\</label\>  
\</td\>  
\</tr\>  
\<tr\>  
\<td class=“TableLeft”\>Questions & Comments:\</td\>  
\<td class=“TableRight”\>\<textarea name=“questions” cols=“35” rows=“5”\>\</textarea\>\</td\>  
\</tr\>  
\</table\>  
\<br\>  
\<div\>  
\<input name=“submit” type=“submit” value=“Send”\>  
\</div\>  
\</form\>[/size]

The script won’t e-mail the form. The error message is:

[size=1] **Warning** : mail() [[/size][[size=1][color=#0000ff]function.mail[/color][/size]](http://localhost/function.mail)[size=1]]: Failed to connect to mailserver at “localhost” port 25, verify your “SMTP” and “smtp\_port” setting in php.ini or use ini\_set() in **F:\WEB\Apache2\htdocs\aaalending\mailer.php** on line **24** [/size]

How do I go about resolving this issue? BTW, if you can’t tell already, I’m a newb when it comes to server-side ANYTHING.
