mediator Posted May 30, 2007 Share Posted May 30, 2007 Hi I have setup a php “email to” form script from my website this form works fine when sending to a web mail I can receive them ! The problem I am having is receiving the emails messages through outlook! The outlook email can receive emails fine when normally sent direct from another email so I know that it’s working correctly, but can not receive emails that are sent through the php “email to” form script. Has anyone come across this problem before? Can you help? (There are no error messages! Just no emails that are sent from the “email to” form script) The code that im using is as follows define("MAIL_TARGET","chris@mortgagepark.co.uk , track@mortgagepark.co.uk"); ini_set("sendmail_from", "root@mortgagepark.co.uk"); chris@mortgagepark.co.uk – this is the email has been configured to outlook and can not receive emails from the form ! track@mortgagepark.co.uk - this is NOT configured to outlook so its just webmail and can receive emails from the php “email to” form script If anyone knows if this is a scripting problem or a outlook problem please reply as im getting to the stage of smashing my PC up !!!!!! Cheers Jay ( Mediator ) Quote Link to comment https://forums.phpfreaks.com/topic/53556-php-mail-help/ Share on other sites More sharing options...
Foser Posted May 30, 2007 Share Posted May 30, 2007 You might want to show us your WHOLE script. Quote Link to comment https://forums.phpfreaks.com/topic/53556-php-mail-help/#findComment-264921 Share on other sites More sharing options...
invisionx Posted May 30, 2007 Share Posted May 30, 2007 Its not outlook but we need to see the script to figure out why it won't send. Quote Link to comment https://forums.phpfreaks.com/topic/53556-php-mail-help/#findComment-264944 Share on other sites More sharing options...
mediator Posted June 2, 2007 Author Share Posted June 2, 2007 <?php // Define your email address - where to send messages - here define("MAIL_TARGET","chris@mortgagepark.co.uk , track@mortgagepark.co.uk"); ini_set("sendmail_from", "root@mediadiverse.org.uk"); // Here you can redefine error messages define("errorName","Invalid name! It must be at least 2 characters long"); define("errorEmail","Invalid email address!"); define("errorMsg","Invalid message! It must be at least 10 characters long"); function createForm($name="",$email="",$tel="",$questions="",$contact="",$error1="",$error2="",$error3=""){ ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <table> <tr> <td 200px>Your Name<?php echo $error1; ?></td> <td><input class="text" type="text" name="name" value="<?php echo $name; ?>"></td> </tr> <tr> <td 200px>Your Email:<?php echo $error2; ?></td> <td><input class="text" type="text" name="email" value="<?php echo $email; ?>"></td> </tr> <tr> <td 200px>Your Phone Number:<?php echo $error3; ?></td> <td><input class="text" type="text" name="tel"value="<?php echo $tel;?>"></td> </tr> <tr> <td 200px>Your Question<?php echo $error3; ?></td> <td><textarea cols="30" rows="4" name="questions"><?php echo $questions;?></textarea></td> </tr> <td 200px>When can we Contact you :<?php echo $error3; ?></td> <td colspan="2"><select name="contact"> <option>Morning</option> <option>Evening</option> <?php echo $contact; ?> </select> </td> </tr> <tr> <td 200px><br/><input class="text" type="submit" name="submitBtn" value="Send"></td> <td><br/></td> </tr> </table> </form> <?php } function isValidEmail($email){ $pattern = "^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$"; if (eregi($pattern, $email)){ return true; } else { return false; } } function sendMail($name,$email,$tel,$questions,$contact){ $subject = "**MORTGAGEPARK.CO.UK EMAIL**"; $from = "From: $name <$email>\r\nReply-To: $email\r\n"; $header = "MIME-Version: 1.0\r\n"."Content-type: text/html; charset=iso-8859-1\r\n"; $content = ($email. "<br /><br />NAME : ".$name. "<br /><br />TELEPHONE : ".$tel. "<br /><br /> ANY OTHER QUESTIONS : ".$questions. "<br /><br />CONTACT THEM : ".$contact ); $content = wordwrap($content,70); mail(MAIL_TARGET,$subject,$content,$from.$header); } ?> THIS NEXT CODE IS IN THE BODY OF THE HTML <?php if (!isset($_POST['submitBtn'])) { createForm(); } else { $name = isset($_POST['name']) ? $_POST['name'] : ""; $email = isset($_POST['email']) ? $_POST['email'] : ""; $tel = isset($_POST['tel']) ? $_POST['tel'] : ""; $questions = isset($_POST['questions']) ? $_POST['questions'] : ""; $contact = isset($_POST['contact']) ? $_POST['contact'] : ""; $error = false; if (strlen($name)<2) { $error = true; $error1 = errorName; } if (!isValidEmail($email)) { $error = true; $error2 = errorEmail; } if ($error){ createForm($name,$email,$tel,$questions,$contact,$error1,$error2,$error3); } else { sendMail($name,$email,$tel,$questions,$contact); ?> <div id="result"> <table > <tr><td> Your message has been sent to chris@mortgagepark.co.uk ! </td></tr> </table> </div> <?php } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/53556-php-mail-help/#findComment-267040 Share on other sites More sharing options...
mediator Posted June 7, 2007 Author Share Posted June 7, 2007 Can anyone help ? Quote Link to comment https://forums.phpfreaks.com/topic/53556-php-mail-help/#findComment-270107 Share on other sites More sharing options...
per1os Posted June 7, 2007 Share Posted June 7, 2007 Change your junk mail filter settings in outlook? Quote Link to comment https://forums.phpfreaks.com/topic/53556-php-mail-help/#findComment-270111 Share on other sites More sharing options...
unidox Posted June 7, 2007 Share Posted June 7, 2007 Change your junk mail filter settings in outlook? Like frost said, the script looks fine to me. Google the outlook settings if you cant find it. Or even resort to a different mail client. Quote Link to comment https://forums.phpfreaks.com/topic/53556-php-mail-help/#findComment-270113 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.