cpopera Posted April 9, 2009 Share Posted April 9, 2009 Help, I'm pulling out what little hair I have left. Setting up a website for a friend designed by another person who has since disappeared. I have everything running except the "contact us" email form which is in PHP coding. Received an error on the mail() function so GoDaddy had me replace that line of coding with $mail->Host = " relay-hosting.secureserver.net"; No more errors! Now if I could just receive the email generated from the website I would be happy. Any suggestions? Code is as follows: <?php include_once("send_to.php"); $Submit = $_POST['Submit']; $comment = $_POST['comment']; $company = $_POST['company']; $email = $_POST['email']; $name = $_POST['name']; $inq_select = $_GET['inq_select']; //-------------------- if($Submit){ $subject="Quotation by $name Tel.no. $company "; $content="Message from $name \n $company \n Request needed: \n $comment"; mail($mailt, $subject, $content,"From: $email"); $mail->Host = " relay-hosting.secureserver.net"; ?> Quote Link to comment Share on other sites More sharing options...
ram4nd Posted April 9, 2009 Share Posted April 9, 2009 Where do you want it? You e-mail, text file, database???? Quote Link to comment Share on other sites More sharing options...
cpopera Posted April 9, 2009 Author Share Posted April 9, 2009 Where do you want it? You e-mail, text file, database???? Email would be fantastic. Thank you for responding so quickly. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted April 9, 2009 Share Posted April 9, 2009 The $mail->Host = " relay-hosting.secureserver.net"; code has nothing to do with the code you posted. It is part of a mailer class that the code is not even using. What was the error before you made that change, because all you apparently did was to replace a line that was generating an error with a useless line of code that does nothing (and is probably generating an error if error_reporting was set to show all types of errors.) Quote Link to comment Share on other sites More sharing options...
cpopera Posted April 9, 2009 Author Share Posted April 9, 2009 What was the error before you made that change, because all you apparently did was to replace a line that was generating an error with a useless line of code that does nothing (and is probably generating an error if error_reporting was set to show all types of errors.) I was getting a server error code 451 while using the following line of code mail($mailt, $subject, $content,"From: $email"); Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted April 9, 2009 Share Posted April 9, 2009 The posted code produces a fatal parse error because it is missing the last }. On a system that is not showing all types of errors, you will get a blank page. The "fix" you made simply stopped the code from executing so any real runtime error it was having is not occurring yet because the code never runs. What was the code before you changed it? Is that the full error message? If not, what is the full error message? Quote Link to comment Share on other sites More sharing options...
cpopera Posted April 9, 2009 Author Share Posted April 9, 2009 Error code is as follows: Warning: mail() [function.mail]: SMTP server response: 451 See http://pobox.com/~djb/docs/smtplf.html. in D:\Hosting\4106152\html\contact.php on line 37 Below is the entire script with html form: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Contact now</title> <style type="text/css"> <!-- .style1 {color: #FFFFFF} body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } --> </style> </head> <body background="images/choco_tile.jpg"> <?php include_once("send_to.php"); $Submit = $_POST['Submit']; $comment = $_POST['comment']; $company = $_POST['company']; $email = $_POST['email']; $name = $_POST['name']; $inq_select = $_GET['inq_select']; //-------------------- if($Submit){ $subject="Quotation by $name Tel.no. $company "; $content="Message from $name \n $company \n Request needed: \n $comment"; mail($mailt, $subject, $content,"From: $email"); ?> <div align="center"><img src="images/edging1.jpg" /></div> <table width="100%" height="500" border="0" cellpadding="0" cellspacing="0"> <tr> <td><div align="center"> <h4 style="color:#FFFFFF;"><strong>We are experiencing technical diffficulties with email. Please call us with inquiries!</strong></h4> </div></td> </tr> </table> <? }else{?> <div align="center"><img src="images/edging1.jpg" /></div> <table width="100%" height="500" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <div> </div> <div align="center"> <form action="<?php echo $PHP_SELP ?>" method="post" name="form1" id="form1"> <table width="379" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="154" align="right" valign="top"><span class="style1"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Name: </font></span></td> <td width="209"><input type="text" name="name" /></td> </tr> <tr> <td align="right" valign="top"><span class="style1"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Email: </font></span></td> <td><input type="text" name="email" /></td> </tr> <tr> <td align="right" valign="top"><span class="style1"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Tel. No. or Mobile No.: </font></span></td> <td><input type="text" name="company" /></td> </tr> <tr> <td colspan="2"><div align="center" class="style1"><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Enter your Request/Comments:</font></div></td> </tr> <tr> <td colspan="2"><div align="center"> <textarea name="comment" cols="35" rows="7" wrap="virtual"></textarea> </div></td> </tr> <tr> <td colspan="2"><div align="center"> <input type="submit" name="Submit" value="Submit" /> </div></td> </tr> </table> <p> </p> </form> </div></td> </tr> </table> <? } ?> </body> </html> Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted April 9, 2009 Share Posted April 9, 2009 If you visit the link that is in the error message (less the dot on the end of it) http://cr.yp.to/docs/smtplf.html you will find that the mail system is expecting CRLF instead of just LF in the message. You would need to replace \n with \r\n The mail system should be doing this for you in the mail body, so it might be that either $mailt (which your code does not contain) or $email has a \n on the end of it that should be removed instead. As a side note, the From: address should be a valid email address hosted on the sending mail server. You should be putting any user supplied email address into the Reply-to: header. And you should be validating all external data to prevent mail header injection that would allow a spammer to send his email through your mail server. Quote Link to comment Share on other sites More sharing options...
kittyshe911 Posted April 27, 2010 Share Posted April 27, 2010 Hello! I'm having the same issue. I have tried everything... I have read through numerous forums and instructions involving GoDaddy, my current e-mail carrier etc. Here is my error: " Warning: mail() [function.mail]: SMTP server response: 451 See http://pobox.com/~djb/docs/smtplf.html. in contact.php on line 76 ERROR! " Here is my code: <?php if(!$_POST) exit; $name = $_POST['name']; $email = $_POST['email']; $phone = $_POST['phone']; $subject = $_POST['subject']; $comments = $_POST['comments']; $verify = $_POST['verify']; if(trim($name) == '') { echo '<div class="error_message">Attention! You must enter your name.</div>'; exit(); } else if(trim($email) == '') { echo '<div class="error_message">Attention! Please enter a valid email address.</div>'; exit(); } else if(trim($phone) == '') { echo '<div class="error_message">Attention! Please enter a valid phone number.</div>'; exit(); } else if(!is_numeric($phone)) { echo '<div class="error_message">Attention! Phone number can only contain digits.</div>'; exit(); } else if(!isEmail($email)) { echo '<div class="error_message">Attention! You have enter an invalid e-mail address, try again.</div>'; exit(); } if(trim($subject) == '') { echo '<div class="error_message">Attention! Please enter a subject.</div>'; exit(); } else if(trim($comments) == '') { echo '<div class="error_message">Attention! Please enter your message.</div>'; exit(); } else if(trim($verify) == '') { echo '<div class="error_message">Attention! Please enter the verification number.</div>'; exit(); } else if(trim($verify) != '4') { echo '<div class="error_message">Attention! The verification number you entered is incorrect.</div>'; exit(); } if($error == '') { if(get_magic_quotes_gpc()) { $comments = stripslashes($comments); } // Configuration option. // Enter the email address that you want to emails to be sent to. // Example $address = "joe.doe@yourdomain.com"; //$address = "example@themeforest.net"; $address = "kittyshe911@yahoo.com"; // Configuration option. // i.e. The standard subject will appear as, "You've been contacted by John Doe." // Example, $e_subject = '$name . ' has contacted you via Your Website.'; $e_subject = 'You\'ve been contacted by ' . $name . '.'; // Configuration option. // You can change this if you feel that you need to. // Developers, you may wish to add more fields to the form, in which case you must be sure to add them here. $e_body = "You have been contacted by $name with regards to $subject, their additional message is as follows.\r\n\n"; $e_content = "\"$comments\"\r\n\n"; $e_reply = "You can contact $name via email, $email or via phone $phone"; $msg = $e_body . $e_content . $e_reply; if(mail($address, $e_subject, $msg, "From: $email\r\nReply-To: $email\r\nReturn-Path: $email\r\n")) { // Email has sent successfully, echo a success page. echo "<fieldset>"; echo "<div id='success_page'>"; echo "<h1>Email Sent Successfully.</h1>"; echo "<p>Thank you <strong>$name</strong>, your message has been submitted to us.</p>"; echo "</div>"; echo "</fieldset>"; } else { echo 'ERROR!'; } } function isEmail($email) { // Email address verification, do not edit. return(preg_match("/^[-_.[:alnum:]]+@((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i",$email)); } ?> Help!!! What am I doing wrong? Thanks! Quote Link to comment 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.