Log in

View Full Version : PHP Email Form not sending to email?



euphoriastudio
02-12-2008, 10:06 PM
I'm stuck. I got all the coding to work from the visitor's side. But its not sending to my email. Can anyone take a look and tell me what i've done wrong? Or if the code is right is it just my host that isn't allowing it? Thanks for your time!



<html>
<head>
<title>Analysis</title>
</head>
<body>
<form method="post" action="sendmail.php">
Name:<input type="text" size="12" maxlength="12" name="name"><br />
Full Address:<input type="text" size="12" maxlength="100" name="address"><br />
Phone:<input type="text" size="12" maxlength="14" name="phone"><br />

Estimated value of home (Appraisal or tax value):<input type="text" size="12" maxlength="100" name="estvalue"><br />

Original loan balance: <input type="text" size="12" maxlength="100" name="orgbal"><br />

Current loan balance: <input type="text" size="12" maxlength="100" name="currbal"><br />

Type of loan:<br>
( fixed, variable, arm, interest only, neg am?) <input type="text" size="12" maxlength="100" name="loantype"><br />

Original Term: (How many years) <input type="text" size="12" maxlength="100" name="orgterm"><br />

Remaining Term: <input type="text" size="12" maxlength="100" name="remainingterm"><br />

Rate of mortgage: <input type="text" size="12" maxlength="100" name="ROM"><br />

Full Monthly Payment: <input type="text" size="12" maxlength="100" name="FMP"><br />

Amount to Escrow: <input type="text" size="12" maxlength="100" name="AtoE"><br />

2nd Mortgage Original balance if applicable: <input type="text" size="12" maxlength="100" name="MorBal2"><br />

Current 2nd balance: <input type="text" size="12" maxlength="100" name="Curr2ndBal"><br />

Type of mortgage: <input type="text" size="12" maxlength="100" name="ToM2"><br />

Term: <input type="text" size="12" maxlength="100" name="Term2"><br />

Remaining Term: <input type="text" size="12" maxlength="100" name="RemainingTerm2"><br />

Rate: <input type="text" size="12" maxlength="100" name="Rate2"><br />

Full Payment: <input type="text" size="12" maxlength="100" name="FMP2"><br />

Other debts to be paid off.
If applicable what is the interest rate, term, and monthly payment?:<br><textarea rows="12" cols="20" name="otherdebts" wrap="physical">(ie: Credit cards, car loans, loans)</textarea><br />

Monthly Net Income:<br>
(If commission give average amount per month) <input type="text" size="12" maxlength="100" name="MNI"><br />

Type of Income:<br />
<select name="incometype">
<option value="weekly">Weekly</option>
<option value="biweekly">Bi-Weekly</option>
<option value="monthly">Monthly</option>
<option value="semimonthly">Semi-Monthly</option</select><br />

Spouses Monthly Net Income if applicable: <input type="text" size="12" maxlength="100" name="SpouseMNI"><br />

Spouses Type of Income: <br />
<select name="incometypespouse">
<option value="weekly">Weekly</option>
<option value="biweekly">Bi-Weekly</option>
<option value="monthly">Monthly</option>
<option value="semimonthly">Semi-Monthly</option</select><br />

How much money is left at the end of the month after life happens?: <input type="text" size="12" maxlength="100" name="moneyleft"><br />

<input type="submit" value="submit" name="submit"><br />
</form><br />
</body>
</html>




<?php
$name = $_REQUEST["name"];
$address = $_REQUEST["address"];
$phone = $_REQUEST["phone"];
$estvalue = $_REQUEST["estvalue"];
$orgbal = $_REQUEST["orgbal"];
$currbal = $_REQUEST["currbal"];
$loantype = $_REQUEST["loantype"];
$orgterm = $_REQUEST["orgterm"];
$remainingterm = $_REQUEST["remainingterm"];
$ROM = $_REQUEST["ROM"];
$FMP = $_REQUEST["FMP"];
$AtoE = $_REQUEST["AtoE"];
$MorBal2 = $_REQUEST["MorBal2"];
$Curr2ndBal = $_REQUEST["Curr2ndBal"];
$ToM2 = $_REQUEST["ToM2"];
$Term2 = $_REQUEST["Term2"];
$RemainingTerm2 = $_REQUEST["RemainingTerm2"];
$Rate2 = $_REQUEST["Rate2"];
$FMP2 = $_REQUEST["FMP2"];
$otherdebts = $_REQUEST["otherdebts"];
$MNI = $_REQUEST["MNI"];
$incometype = $_REQUEST["incometype"];
$SpouseMNI = $_REQUEST["SpouseMNI"];
$incometypespouse = $_REQUEST["incometypespouse"];
$moneyleft = $_REQUEST["moneyleft"];
$embody = "$name $address $phone $estvalue $orgbal $currbal $loantype $orgterm $remainingterm $ROM $FMP $AtoE $MorBal2 $Curr2ndBal $ToM2 $Term2 $RemainingTerm2 $Rate2 $FMP2 $otherdebts $MNI $incometype $SpouseMNI $incometypespouse $moneyleft";

mail( "euphoria.studio@gmail.com", "Analysis Request", $embody, "From: $name" );
header( "Location: http://formtest.freehostia.com/analysis.html" );
?>


is for short codes only.

tonyking
02-14-2008, 08:04 PM
I'm no guru at all, but I ran into a similar problem so let's see if I can help.

I beleive your script is fine, and executes as it should. The most likely cause for not receiving the email is improperly formatted headers being blocked.

Try editing your PHP code to this:



<?php
$name = $_REQUEST["name"];
$address = $_REQUEST["address"];
$phone = $_REQUEST["phone"];
$estvalue = $_REQUEST["estvalue"];
$orgbal = $_REQUEST["orgbal"];
$currbal = $_REQUEST["currbal"];
$loantype = $_REQUEST["loantype"];
$orgterm = $_REQUEST["orgterm"];
$remainingterm = $_REQUEST["remainingterm"];
$ROM = $_REQUEST["ROM"];
$FMP = $_REQUEST["FMP"];
$AtoE = $_REQUEST["AtoE"];
$MorBal2 = $_REQUEST["MorBal2"];
$Curr2ndBal = $_REQUEST["Curr2ndBal"];
$ToM2 = $_REQUEST["ToM2"];
$Term2 = $_REQUEST["Term2"];
$RemainingTerm2 = $_REQUEST["RemainingTerm2"];
$Rate2 = $_REQUEST["Rate2"];
$FMP2 = $_REQUEST["FMP2"];
$otherdebts = $_REQUEST["otherdebts"];
$MNI = $_REQUEST["MNI"];
$incometype = $_REQUEST["incometype"];
$SpouseMNI = $_REQUEST["SpouseMNI"];
$incometypespouse = $_REQUEST["incometypespouse"];
$moneyleft = $_REQUEST["moneyleft"];
$embody = "$name $address $phone $estvalue $orgbal $currbal $loantype $orgterm $remainingterm $ROM $FMP $AtoE $MorBal2 $Curr2ndBal $ToM2 $Term2 $RemainingTerm2 $Rate2 $FMP2 $otherdebts $MNI $incometype $SpouseMNI $incometypespouse $moneyleft";
$headers = 'From: euphoria.studio@gmail.com' . "\r\n" .
'Reply-To: euphoria.studio@gmail.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();

mail( "euphoria.studio@gmail.com", "Analysis Request", $embody, $headers );
?>



Again I am not very strong in this area, but if that works, and you receive the email, it was definitely a problem with your mail header.

Hope this helps!