Alexhoward Posted March 24, 2008 Share Posted March 24, 2008 Hi Guys, i've modified a contact us script but it's not actualling sending anything... (or i'm not receiving it....) does anyone have the time to please tell me why...? contact.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>EveryOnlineStore.co.uk Email Form </title> </head> <body> </body> <?php include ("banner.php"); ?> <form method="post" action="sendemail.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 ?>" /> Your Name: <br /> <input type="text" name="visitor" size="35" /> <br /> Your Email:<br /> <input type="text" name="visitormail" size="35" /> <br /> <br /> <br /> Attention:<br /> <select name="attn" size="1"> <option value=" Sales n Billing ">Sales n Billing </option> <option value=" General Support ">General Support </option> <option value=" Technical Support ">Technical Support </option> <option value=" Webmaster ">Webmaster </option> </select> <br /><br /> Mail Message: <br /> <textarea name="notes" rows="4" cols="40"></textarea> <br /> <input type="submit" value="Send Mail" /> <br /> </form> </body> </html> sendemail.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>EveryOnlineStore.co.uk is sending the message...</title> </head> <body> <?php $ip = $_POST['ip']; $httpref = $_POST['httpref']; $httpagent = $_POST['httpagent']; $visitor = $_POST['visitor']; $visitormail = $_POST['visitormail']; $notes = $_POST['notes']; $attn = $_POST['attn']; if (eregi('http:', $notes)) { die ("Do NOT try that! ! "); } 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] \n Attention: $attn \n Message: $notes \n From: $visitor ($visitormail)\n Additional Info : IP = $ip \n Browser Info: $httpagent \n Referral : $httpref \n "; $from = "From: $visitormail\r\n"; mail("[email protected]", $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> </body> </html> Thanks in Advance!! Link to comment https://forums.phpfreaks.com/topic/97556-contact-us-form-not-sending-emails/ Share on other sites More sharing options...
ohdang888 Posted March 24, 2008 Share Posted March 24, 2008 i made my contact script to upload it to a db, then it alerts my on my browser when someone has contacted me, and i creates a page that displays all of it... i just find that way a lot easier. Link to comment https://forums.phpfreaks.com/topic/97556-contact-us-form-not-sending-emails/#findComment-499157 Share on other sites More sharing options...
Alexhoward Posted March 24, 2008 Author Share Posted March 24, 2008 That sounds nice... but mysql has gone down at the moment....! well... for the past 2 days!?! so i'd like to try this way, plus i think it's an easier way. thanks for your suggestion thou! Link to comment https://forums.phpfreaks.com/topic/97556-contact-us-form-not-sending-emails/#findComment-499158 Share on other sites More sharing options...
Alexhoward Posted March 24, 2008 Author Share Posted March 24, 2008 Hi, Is there anyone out there that can point me in the right direction...? Im not asking for someone to do it for me, so i can just copy and paste, i like learning this stuff but this is doing my head in... i have no idea why it doesn't work Thanks! Link to comment https://forums.phpfreaks.com/topic/97556-contact-us-form-not-sending-emails/#findComment-499469 Share on other sites More sharing options...
revraz Posted March 24, 2008 Share Posted March 24, 2008 You can try changing $from = "From: $visitormail\r\n"; to an email on your domain. Link to comment https://forums.phpfreaks.com/topic/97556-contact-us-form-not-sending-emails/#findComment-499476 Share on other sites More sharing options...
Alexhoward Posted March 24, 2008 Author Share Posted March 24, 2008 Thanks for your reply, so you're saying from: $from = "From: $visitormail\r\n"; to $from = "From: [email protected]"; sorry if this is a really stupid question... Link to comment https://forums.phpfreaks.com/topic/97556-contact-us-form-not-sending-emails/#findComment-499488 Share on other sites More sharing options...
Alexhoward Posted March 24, 2008 Author Share Posted March 24, 2008 Hi, I've tried your suggestion in a number of ways, but i'm still not recieving anything my webhosts say on their website: You can also use the PHP mail function and set the mail "from address" using the following line of code (replacing email@mydomain with the correct domain name). ini_set("sendmail_from", " email@mydomain "); but i don't understand... Link to comment https://forums.phpfreaks.com/topic/97556-contact-us-form-not-sending-emails/#findComment-499496 Share on other sites More sharing options...
revraz Posted March 24, 2008 Share Posted March 24, 2008 Try a single, one line .php file <?php mail("youremail", "subject", "message", "FROM: youremail"); ?> Replace "youremail" with your email address that is on that domain from your webhost. Link to comment https://forums.phpfreaks.com/topic/97556-contact-us-form-not-sending-emails/#findComment-499518 Share on other sites More sharing options...
Alexhoward Posted March 24, 2008 Author Share Posted March 24, 2008 Thanks! however, nothing is coming through, just sent a test from hotmail to the same address, and it turned up straight away.....? Link to comment https://forums.phpfreaks.com/topic/97556-contact-us-form-not-sending-emails/#findComment-499535 Share on other sites More sharing options...
revraz Posted March 24, 2008 Share Posted March 24, 2008 You need to ask your host for the error or if you have access to the Log file, see if you can find an error. Link to comment https://forums.phpfreaks.com/topic/97556-contact-us-form-not-sending-emails/#findComment-499560 Share on other sites More sharing options...
Alexhoward Posted March 24, 2008 Author Share Posted March 24, 2008 Hi, for the error...? i just assume it's being blocked or something? i'll email them Thanks Link to comment https://forums.phpfreaks.com/topic/97556-contact-us-form-not-sending-emails/#findComment-499564 Share on other sites More sharing options...
Alexhoward Posted March 24, 2008 Author Share Posted March 24, 2008 i do have access to the log files on my ftp server but they mean nothing to me.... what should i be looking for? Link to comment https://forums.phpfreaks.com/topic/97556-contact-us-form-not-sending-emails/#findComment-499587 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.