Reebokrebel Posted December 7, 2012 Share Posted December 7, 2012 Please can someone advise on the following script why I get no sender in the e mail address header and not the senders e mail address The form works fine but I just keep getting the No Sender" Thanks <?php /*Subject and E Mail Variables */ $emailSubject = 'Annuity Vault Calculator Quotation Request' ; $webMaster = 'adrian.moss@hotmail.co.uk' ; /* Gathering Data Variable */ $titleField = $_POST['Title']; $forenameField = $_POST['Forename']; $surnameField = $_POST['Surname']; $dobField = $_POST['DOB']; $telephoneField = $_POST['Telephone']; $emailField = $_POST['Email']; $pfvField = $_POST['PFV']; $smokeField = $_POST['CheckboxGroup1']; $medicationField = $_POST['CheckboxGroup2']; $body = <<<EOD <br><hr><br> Title: $titleField <br> Forename: $forenameField <br> Surname: $surnameField <br> Date Of Birth: $dobField <br> Telephone Number: $telephoneField <br> E Mail Address: $emailField <br> Pension Fund Value: $pfvField <br> Do They Smoke: $smokeField <br> Are They On Medication: $medicationField <br> EOD; $headers = "From: $Email\r\n"; $headers .= "Content-type: text/html\r\n"; $success = mail ($webMaster, $emailSubject, $body, $headers); /* Results Rendered as HTML */ $theResults = <<<EOD <html> <head> <title>JakesWorks - travel made easy-Homepage</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <style type="text/css"> <!-- body { background-color: #f1f1f1; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-style: normal; line-height: normal; font-weight: normal; color: #666666; text-decoration: none; } body p { font-family: Georgia, "Times New Roman", Times, serif; } body p { font-family: Georgia, "Times New Roman", Times, serif; font-size: 16px; color: #390; } body p { font-size: 24px; } body p { text-align: center; } --> </style> </head> <div> <div align="left"> <p>Thank You For Your Interest! We Will Contact You Soon With Your Quotation</p> <p>To Return To Home Page Click Here</p> <form name="form1" method="post" action=""> </form> <p><a href="http://annuityvault.co.uk/"><img src="http://www.iconsfeed.com/upload/512/61.png" alt="Home Button icon" width="250" height="250"></a></p> </div> </div> </body> </html> EOD; echo "$theResults"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/271717-e-mail-php-form/ Share on other sites More sharing options...
DavidAM Posted December 10, 2012 Share Posted December 10, 2012 $headers = "From: $Email\r\n"; The $EMail variable has not been defined, and therefore has no value. Quote Link to comment https://forums.phpfreaks.com/topic/271717-e-mail-php-form/#findComment-1398468 Share on other sites More sharing options...
Christian F. Posted December 10, 2012 Share Posted December 10, 2012 Also, make sure you validate your input, especially the e-mail addresses. Otherwise any malicious user could easily hijack your script, and use it to spam anyone in the world. From your address. Quote Link to comment https://forums.phpfreaks.com/topic/271717-e-mail-php-form/#findComment-1398480 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.