Simple PHP Help Pleeeeease!

ny-1373

New Member
Messages
2
Reaction score
0
Points
0
Hey there,

Just wondering if anyone can help me with my email form, It doesn't seem to send the actual mail.

Heres the code for the form

PHP:
 <form method="post" action="sendeail.php">          <!-- DO NOT change ANY of the php sections -->          <?php$ipi = getenv("REMOTE_ADDR");$httprefi = getenv ("HTTP_REFERER");$httpagenti = getenv ("HTTP_USER_AGENT");?>          <input type="hidden" name="ip" value="<?php echo $ipi ?>" />          <input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />          <input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />          <br />  <input name="visitor" type="text" value="Name" size="35" />  <br />          <br />  <input name="visitormail" type="text" value="Email" size="35" />  <br />  <br />  <select name="attn" size="1">    <option value="Insulation" selected="selected">Insulation</option>    <option value="Solar">Solar</option>    <option value="General Contact">General Contact</option>    <option value=" Webmaster ">Webmaster </option>  </select>  <br />          <br />  <textarea name="notes" rows="4" cols="40">Address</textarea>  <br />  <br />  <input type="submit" value="Send Mail" />          Mail Message: <br />  <br />  <br />        </form>

and heres the send script:

PHP:
<?php
$ip = $_POST['ip']; $httpref = $_POST['httpref']; $httpagent = $_POST['httpagent']; $visitor = $_POST['visitor']; $visitormail = $_POST['visitormail']; $notes = $_POST['notes'];$attn = $_POST['attn'];
if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,"."))) {echo "<h2>Use Back - Enter valid e-mail</h2>\n"; $badinput = "<h2>Feedback was NOT submitted</h2>\n";echo $badinput;die ("Go back! ! ");}
if(empty($visitor) || empty($visitormail) || empty($notes )) {echo "<h2>Use Back - fill in all fields</h2>\n";die ("Use back! ! "); }
$todayis = date("l, F j, Y, g:i a") ;
$attn = $attn ; $subject = $attn; 
$notes = stripcslashes($notes); 
$message = " $todayis [EST] \nAttention: $attn \nMessage: $notes \n From: $visitor ($visitormail)\nAdditional Info : IP = $ip \nBrowser Info: $httpagent \nReferral : $httpref \n";
$from = "From: $visitormail\r\n";

mail("ny-13@hotmail.com", $subject, $message, $from);
?>
<p align="center">Date: <?php echo $todayis ?> <br />Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> ) <br />
Attention: <?php echo $attn ?><br /> Message:<br /> <?php $notesout = str_replace("\r", "<br/>", $notes); echo $notesout; ?> <br /><?php echo $ip ?> 
<br /><br /><a href="contact.php"> Next Page </a> </p>
 

mobstermind61

Member
Messages
47
Reaction score
6
Points
8
did you create the right file for the send email script, because if you created the file call sendemail.php then the action at the top is wrong because the sendeail.php is spelled differently, i had that issue before. Make sure you rename the file to sendeail.php or rename the code in the form to sendemail.php.
 

ny-1373

New Member
Messages
2
Reaction score
0
Points
0
did you create the right file for the send email script, because if you created the file call sendemail.php then the action at the top is wrong because the sendeail.php is spelled differently, i had that issue before. Make sure you rename the file to sendeail.php or rename the code in the form to sendemail.php.

Yeah, I noticed that typo and I changed the file name. Still doesnt work, Is there a working script online anywhere that I can just copy and paste in?...
 

essellar

Community Advocate
Community Support
Messages
3,295
Reaction score
227
Points
63
If you're running the script here on a Free Hosting plan, you'll find that it's the $from variable that's preventing the mailsend. You can only send mail from a mail account that actually exists in your Free Hosting account -- spoofing the sender (or any other part of the email header) is not allowed.
 

mobstermind61

Member
Messages
47
Reaction score
6
Points
8
I would use this contact form http://www.freecontactform.com/email_form.php It seems to be structured a little better. I know the contact form your using and its not exactly the best one to use that is free, the one on the other side of the link i provided for you is a much better one, let me know if you need help. Ill be glad to walk you through the steps if need be.

---------- Post added at 11:07 AM ---------- Previous post was at 10:57 AM ----------

I just noticed something, also a lot of the times a php form will not allow you to receive an email to a aol, live or sub email account, for some reason they don't allow it so you would need to create an email account in your cpanel like admin@yourwebsite.com to actually receive an email from a client.

mail("ny-13@hotmail.com <----that will not work ", $subject, $message, $from);
 

fretwizz

Member
Messages
106
Reaction score
3
Points
18
FYI there can be issues with copying and pasting php scripts. That aside... I see the need for a space in your form tag after the php tag.
 
Top